Reputation: 51
I'm new to Django and i've already come across a problem. I'm using Django 1.4.3 on OSX Mountain lion.
When I start a new app using
django-admin.py startapp "name"
the app is created and all the necessary files are within it (__Init__.py
, models.py
, tests.py
, views.py
). However, the admin.py
file which should be automatically created is not in the app folder. Without it, i cannot edit my administrator site preferences.
Any ideas as to why this may be happening?
Upvotes: 5
Views: 7602
Reputation: 25164
You are most likely reading the dev tutorial but using a stable release (currently 1.4.3). admin.py
is created by startapp
as of this commit which also updated the tutorial documentation but it won't make it into a stable release until 1.6.
Upvotes: 4
Reputation: 6983
Admin.py is not generated. In response to OP's to your comment on the post above:
From part 1 of the tutorial: https://docs.djangoproject.com/en/1.4/intro/tutorial01/
Let’s look at what startproject created:
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
wsgi.py
And on part 2, under the section "Make the poll app modifiable in the admin" it says:
But where’s our poll app? It’s not displayed on the admin index page.
Just one thing to do: We need to tell the admin that Poll objects have an admin interface. To do this, create a file called admin.py in your polls directory, and edit it to look like this:
from polls.models import Poll
from django.contrib import admin
admin.site.register(Poll)
Upvotes: 2
Reputation: 111
You have to create the file manually since the django admin is disabled by default.
Instructions on what to put in admin.py are here.
Upvotes: 8