Forums

Admin site did not work at all

Hi,

I am very frustrated, but I could not manage how to make my admin (sqlite) site working. I tried many times and what I get is: Page not found.

I do not understand why. I followed the tutorial: https://www.pythonanywhere.com/wiki/FollowingTheDjangoTutorial and get stuck at part 2. After the model change, migrations ... everything worked fine at console. But I can not get the admin site for my database.

I also did it in my local computer (following https://docs.djangoproject.com/en/1.8/intro/tutorial02/). In my computer is working. So I do not know what happened.

The only difference is that I am using Python 2.7 (and not 3.4 as the tutorial recommends). is this make any difference to PythonAnywhere?


This is a piece of my settings:

ALLOWED_HOSTS = ['bangkok.pythonanywhere.com']
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls',
)

Nothing wrong with my models:

(django17)01:05 ~/web $ python manage.py migrate 
Operations to perform:
  Synchronize unmigrated apps: staticfiles, messages
  Apply all migrations: admin, contenttypes, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying sessions.0001_initial... OK
(django17)01:06 ~/web $ python manage.py startapp polls
(django17)01:11 ~/web $ python manage.py makemigrations polls
System check identified some issues:

WARNINGS:
polls.Player.age: (fields.W122) 'max_length' is ignored when used with IntegerField
        HINT: Remove 'max_length' from field
Migrations for 'polls':
  0001_initial.py:
    - Create model Area
    - Create model Experiment
    - Create model GameWorld
    - Create model Generation
    - Create model PFront
    - Create model Play
    - Create model Player
    - Create model Population
    - Add field play_player to play
    - Add field world to experiment
    - Add field world to area
(django17)01:20 ~/web $ python manage.py migrate                                                                                                       
System check identified some issues:
WARNINGS:
polls.Player.age: (fields.W122) 'max_length' is ignored when used with IntegerField
        HINT: Remove 'max_length' from field
Operations to perform:
  Synchronize unmigrated apps: staticfiles, messages
  Apply all migrations: admin, contenttypes, polls, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying polls.0001_initial... OK
(django17)01:21 ~/web $ python manage.py createsuperuser
System check identified some issues:

Please, help, I do not know what to do...

[ edited by admin: formatting ]

Hi there,

The next step would be to go to your wsgi file and comment out the hello world stuff and uncomment the django stuff, and set up the path to your project correctly there.

That is it! Now it is working. Perfect and thank you very much.

             / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\    
<<<<<<:>~  <   Yay!           |   
             \_________/