Search code examples
pythondjangopythonanywhere

PythonAnywhere credentials cannot access the Django Control Panel


I am a Django and PythonAnywhere newbie, so I am currently on a steep learning curve.

I have hit a brick wall at the initial stages of trying to set up the tutorial Django app. When I hit Part 2, 'The admin site' I tried to access the admin control panel using my PythonAnywhere username and password. As a result I got back an error saying I had to enter a correct staff username and password. Since there is no step in the instructions saying how to setup a staff user, am I not correct in assuming that my PythonAnywhere credentials should be working as the correct staff credentials by default? What am I missing here?

I've tried Googling for an answer, but the only comment that made any sense to me was that the web server had to have the correct path to the virtual environment variables. As near as I can tell though I have already set this correctly in the web application control panel as:

/home/vocabulator/.virtualenvs/django18

I am sure Django 1.8 is correctly installed, but I will run any diagnostic lines anyone wants me to run to demonstrate this.

I look forward to your response. In the mean time I will try to setup a localhost copy of Django to see if this will give me some clues as to what may be going on.


Solution

  • You still have to create an admin user, as far as i know it doesn't get created by default.

    Taken from https://docs.djangoproject.com/en/1.8/intro/tutorial02/ :

    Creating an admin user

    First we’ll need to create a user who can login to the admin site. Run the following command:

    $ python manage.py createsuperuser
    

    Enter your desired username and press enter.

    Username: admin
    

    You will then be prompted for your desired email address:

    Email address: [email protected]
    

    The final step is to enter your password. You will be asked to enter your password twice, the second time as a confirmation of the first.

    Password: **********
    Password (again): *********
    Superuser created successfully.
    

    Hope this helps.