Python和Django的新手。
在这里创建了第一个应用。
我的Django Rest API在本地运行良好。我尝试部署到PCF。
我的manage.py如下所示
#!/usr/bin/env python
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
and required.txt是
Django
django-toolbelt
djangorestframework
gunicorn
,runtime.txt是
python-x.x.x
我也很喜欢创建Manifest.yml
applications:
- name: MyPythonApp
memory: 128MB
disk_quota: 256MB
random-route: true
但是我遇到如下错误
File "manage.py", line 16
2019-12-26T13:12:06.88-0500 [APP/PROC/WEB/0] ERR ) from exc
2019-12-26T13:12:06.88-0500 [APP/PROC/WEB/0] ERR ^
2019-12-26T13:12:06.88-0500 [APP/PROC/WEB/0] ERR SyntaxError: invalid syntax