Skip to content
Advertisement

How to overwrite Django app to Pythonanywhere?

After the second time deploying the Django app to Pythonanywhere, (I re-edited and overwritten in VS code and did git push) I got the following error.

WARNING: Package(s) not found: django
Traceback (most recent call last):
  File "/home/hogehohe/.local/bin/pa_autoconfigure_django.py", line 47, in <module>
    main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
  File "/home/hogehohe/.local/bin/pa_autoconfigure_django.py", line 36, in main
    project.update_settings_file()
  File "/home/hogehohe/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 74, in update_settings_file
    new_django = version.parse(self.virtualenv.get_version("django")) >= version.parse("3.1")
  File "/home/hogehohe/.local/lib/python3.6/site-packages/pythonanywhere/virtualenvs.py", line 32, in get_version
    output = subprocess.check_output(commands).decode()
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/hogehohe/.virtualenvs/hogehohe.pythonanywhere.com/bin/pip', 'show', 'django']' returned non-zero exit status 1.

The command is

$ pa_autoconfigure_django.py https://github.com/[user_name]/[project_name].git --nuke

The first deployment succeeded but the second one is not. I don’t know the cause and how to overwrite it…

Advertisement

Answer

You need to have a requirements.txt file in your project that specifies the packages that you need for your app. I’m guessing that your first project had one that included django and that your second one does not.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement