我试图在NGINX和uWSGI后面运行Django应用程序,但是datetime.today()
返回从当今uWSGI服务器启动时的日期时间。 该应用的配置如下:Django应用程序uWSGI有错误的datetime.today()结果,显示开始日期
<uwsgi> <plugin>python</plugin> <socket>127.0.0.1:3030</socket> <chdir>/opt/ETS/bin</chdir> <pythonpath>..</pythonpath> <module>instance</module> </uwsgi>
为uWSGI的设置是没有改变的默认值。
我怎样才能让日期时间再次工作?
澄清: 呼叫在这里所进行的访问URL
def create_file_header(name, ext):
return {'Content-Disposition': 'attachment; filename=%s-%s.%s' % (name, datetime.date.today(), ext) }
呼叫从urlpatten:
(r'^loading_details/basic2/$', ExpandedResource(ReadLoadingDetailHandler, authentication=authentication, headers=create_file_header('loading-details', 'csv')), FORMAT_CSV, "api_loading_details_basic_auth"),
它的工作使用Apache WSGI同一台服务器上托管时
我不是在启动时调用它,而是从函数内调用 – tcarlander 2013-02-25 11:13:24
@tcarlander:什么调用该函数?该函数的*结果*是否在模块加载时存储? – 2013-02-25 11:17:54
谢谢,这解释了它。我仍然不明白为什么它在Apache WSGI上工作,而不是在uWSGI上工作,我想他们的运行方式不同。 – tcarlander 2013-02-26 04:45:40