我有一个本地的Django项目,运行良好。我正在按照pythonanywhere(https://help.pythonanywhere.com/pages/DeployExistingDjangoProject/)的指示操作。我设置了一个virtualenv,并确保我的Django版本匹配。
当我运行./manage.py migrate
时,我得到一个权限被拒绝的错误:bash: ./manage.py: Permission denied
如果我尝试运行python3 manage.py migrate
,则会出现时区设置错误
Bash控制台输出
(Tooling-virtualenv) 09:31 ~/Tooling/Tooling (master)$ python3 manage.py migrate
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/core/management/__init__.py", line 325, in execute
settings.INSTALLED_APPS
File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 189, in __init__
raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
ValueError: Incorrect timezone setting: America\Los_Angeles
pythonanywhere错误日志
2019-11-26 01:20:11,190: Error running WSGI application
2019-11-26 01:20:11,200: ValueError: Incorrect timezone setting: America\Los_Angeles
2019-11-26 01:20:11,200: File "/var/www/username_pythonanywhere_com_wsgi.py", line 54, in <module>
2019-11-26 01:20:11,200: application = get_wsgi_application()
2019-11-26 01:20:11,200:
2019-11-26 01:20:11,200: File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-11-26 01:20:11,200: django.setup(set_prefix=False)
2019-11-26 01:20:11,201:
2019-11-26 01:20:11,201: File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
2019-11-26 01:20:11,201: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2019-11-26 01:20:11,201:
2019-11-26 01:20:11,201: File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__
2019-11-26 01:20:11,202: self._setup(name)
2019-11-26 01:20:11,202:
2019-11-26 01:20:11,202: File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup
2019-11-26 01:20:11,202: self._wrapped = Settings(settings_module)
2019-11-26 01:20:11,202:
2019-11-26 01:20:11,202: File "/home/username/.virtualenvs/Tooling-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 189, in __init__
2019-11-26 01:20:11,203: raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
我已经确认“America/Los_Angeles”存在于/usr/share/zoneinfo下。我尝试更改大小写,并尝试更改为“US/Pacific '。这两种方法都没有产生任何不同的结果。我还将pythonanywhere时区更新为”America/Los_Angeles“以匹配。
除了从头开始我的Django项目,导入我需要的文件之外,我不知道下一步该怎么做。
2条答案
按热度按时间stszievb1#
我能够通过注解掉www.example.com中的时区settings.py并将以下内容添加到我的WSGI顶部来解决这个问题。
bnl4lu3b2#
在WSGI顶部添加以下内容:
然后在base上运行以下命令:
则命令
./manage.py migrate
将起作用。