Forums

invalid manage.py killing my Django webapp

I cannot get my django application to deply as my webapp. I have tried a few times over several days but I can't get it to work.

I'm following the excellent DjangoGirls tutorial, specifically https://tutorial.djangogirls.org/en/deploy/.

I used my personal access token and was able to authenticate. However when I run the autoconfigure:

pa_autoconfigure_django.py --python=3.6 --nuke https://github.com/robline/skip.git

I get a collectstatic failed because there is no module named django_extensions:

ModuleNotFoundError: No module named 'django_extensions'
Traceback (most recent call last):
  File "/home/robline/.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/robline/.local/bin/pa_autoconfigure_django.py", line 37, in main
    project.run_collectstatic()
  File "/home/robline/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 87, in run_collectstatic
    '--noinput',
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/robline/.virtualenvs/robline.pythonanywhere.com/bin/python', '/home/robline/robline.pythonanywhere.com/manage.py', 'collectstatic', '--noinput']' returned non-zero exit status 1.

So I tried to install django-extensions and it says requirement already satisfied:

18:42 /home $ pip3.6 install --user django_extensions
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: django_extensions in ./robline/.local/lib/python3.6/site-packages (3.0.9)

When I try to manually run collectstatic it fails because I'm not in the correct directory. I'd expect the automatic virtualenv creation to put me there which is why I mention it. Anyway I navigated to the correct directory to collect static, and also tried create superuser:

python manage.py collectstatic

And I got a SyntaxError:

18:50 ~/robline.pythonanywhere.com (main)$ python manage.py createsuperuser
  File "manage.py", line 17
    ) from exc
         ^
SyntaxError: invalid syntax

I am not sure what else to try. Thanks for any insights!

The pa_autoconfigure_django.py script expects you to have a file in your repository called requirements.txt, which lists all of your site's dependencies. It will then create a new virtualenv using the version of Python that you specified, and install those dependencies into it.

It looks like your repository either doesn't have that file, or doesn't list django_extensions in there, which is why you're getting the first error. The result of that is that the virtualenv isn't fully created, which is the cause of the other errors.

Thank you so much, that got me past the install.

I'm now having tons of pathing issues. It can't find base.html for example. I've followed the steps at https://help.pythonanywhere.com/pages/DebuggingImportError and in a shell when I tried to import settings.py its said pathlib was missing. I installed pathlib and now it says ImportError: No module named py. Again I appreciate any light you can shed. I'm so close!

I wonder if you are running the wrong python in your shell. Make sure you are using your virtualenv python