PythonAnywhere Forums

Django Admin page

Django Newbie here,

I can't access my admin page, keep getting the error below.

Django Version: 1.10 Exception Type: NoReverseMatch Exception Value: 'en-us' is not a registered namespace Exception Location: /usr/local/lib/python3.5/dist-packages/django/urls/base.py in reverse, line 87 Python Executable: /usr/local/bin/uwsgi Python Version: 3.5.2

any ideas? I can't see any errors in the URL set up. url(r'^admin/',admin.site.urls)

Is there a built in template for admin on django or do i need to create one?

Many Thanks

According to this stack overflow post about the errors, you may want to look at the previous error. It also sounds like this could be from a version mismatch (eg: if you had initially setup the django website with a lower version and then upgraded django)

I set it up only a week or so ago, with Python 3.5 and Django 1.10. My templates load fine, its just he admin page.

I've already read that post prior to posting here, but for a django beginner it might as well be written in Chinese.

If you take a look at your error log, the latest error is

OSError: No translation files found for default language .

That sounds like you have a LANGUAGE_CODE = "" in your settings.py or something.

Thanks. Yeah, I had seen the 'en-us' error, so i tried changing to 'en-gb' and then ' ', but neither worked unfortunately.

I also get a similar error when I try to add a super user using hte Bash console:

python manage.py createsuperuser

I had previously run the below in a postgres console, just wondering if that upset things:

CREATE DATABASE myappdb;

CREATE USER myappuser WITH PASSWORD 'a-nice-random-password';

ALTER ROLE myappuser SET client_encoding TO 'utf8'; ALTER ROLE myappuser SET default_transaction_isolation TO 'read committed'; ALTER ROLE myappuser SET timezone TO 'UTC';

GRANT ALL PRIVILEGES ON DATABASE myappdb TO myappuser ;

right. do all of them say no translation files? or do they have different errors?

I don't think the postgres stuff would change things. But I would perhaps try to setup a new django webapp again and see if you run into those errors from a new webapp.

I set up the same webapp, piece by piece on my other test account and the below, url pattern, seems to be what was causing the problem.

url(r'^myapp/',include('myapp.urls')),

I have the admin site back up now.

Thanks for your help.

Great!

That sounds like maybe there is something wrong with your myapp.urls, or that you did not add myapp to installed_apps etc.