我在tornado服务器上运行一个django应用程序。在
通过使用此脚本:
#!/usr/bin/env python
#
# Runs a Tornado web server with a django project
# Make sure to edit the DJANGO_SETTINGS_MODULE to point to your settings.py
#
# http://localhost:8080/hello-tornado
# http://localhost:8080
import sys
import os
from tornado.options import options, define, parse_command_line
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
from django.core.wsgi import get_wsgi_application
define('port', type=int, default=8080)
class HelloHandler(tornado.web.RequestHandler):
def get(self):
self.write('Hello from tornado')
def main():
os.environ['DJANGO_SETTINGS_MODULE'] = 'siatpre.settings' # TODO: edit this
sys.path.append('./siatpre8') # path to your project if needed
parse_command_line()
wsgi_app = get_wsgi_application()
container = tornado.wsgi.WSGIContainer(wsgi_app)
tornado_app = tornado.web.Application(
[
('/hello-tornado', HelloHandler),
('.*', tornado.web.FallbackHandler, dict(fallback=container)),
])
server = tornado.httpserver.HTTPServer(tornado_app)
server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == '__main__':
main()
项目路径(siatpre8)是正确的,一切都运行得很好,唯一的问题是管理风格的静态文件和上传到应用程序的文件。在
但是,即使在我的设置.py. 在
这是一个开发环境,有什么想法吗?在
如果你需要更多的细节,请告诉我。在
提前谢谢!在
编辑
我的目录布局:
^{pr2}$我的settings.py
静态文件结构声明:
STATIC_URL = '/static/'
#ADMIN_MEDIA_PREFIX = '/static/'
STATICFILES_DIRS = [
"home/kkoci/siatpre3.3.1/siatpre2015/siatpre8/siatpre/static/admin/",
"home/kkoci/siatpre3.3.1/siatpre2015/siatpre8/siatpre/media/archivosDeCarga/",
#"/home/polls.com/polls/static",
#"/opt/webfiles/common",
]
STATIC_ROOT = '/static/admin/'
#ADMIN_MEDIA_PREFIX = '/static/admin/css/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__),'templates'),
)
MEDIA_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__),'media/'))
MEDIA_URL = '/media/'
目前没有回答
相关问题 更多 >
编程相关推荐