Skip to main content
 首页 » 编程设计

python之在 PythonAnywhere 上部署 Django 应用程序

2024年08月22日29tuyile006

我是 Django 的新手,我制作了一个应用程序。这是 github 存储库的链接:https://github.com/akashmalla07/spring .我跟着这个http://tutorial.djangogirls.org/en/deploy/部署我的代码,在运行 python manage.py migrate 时出现此错误

ImportError: No module named 'django_nose'  

我在本地机器上开发时没有遇到这个问题,但我在 PythonAnywhere 上遇到了这个问题。请帮我。提前致谢

已编辑 按照您的解决方案后我得到了这个错误

  File "/tmp/pip-build-_l_qs3mn/wsgiref/setup.py", line 5, in <module> 
    import ez_setup 
  File "/tmp/pip-build-_l_qs3mn/wsgiref/ez_setup/__init__.py", line 170 
    print "Setuptools version",version,"or greater has been installed." 
                             ^ 
SyntaxError: Missing parentheses in call to 'print' 
 
---------------------------------------- 
 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip- 
 build-_l_qs3mn/wsgiref/ 

我已经提到了其他 stackoverflow 解决方案,即

  pip install --upgrade setuptools  

但对我不起作用。

请您参考如下方法:

看起来您的项目需要一些额外的模块 -- 在您的 requirements.txt 中你有这个:

Django==1.8.3 
django-nose==1.4.1 
nose==1.3.7 
requests==2.7.0 
wsgiref==0.1.2 

您所遵循的教程仅包含有关如何安装其演示应用程序所需模块的说明,即 Django。因此,您还需要安装额外的模块。

为此,在安装了 django 的 Bash 控制台中,您需要运行以下命令:

pip install -r /home/yourpythonanywhereusername/spring/requirements.txt 

不要忘记将 yourpythonanywhereusername 替换为您实际的 PythonAnywhere 用户名。