Django logo (Photo credit: Wikipedia) |
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
We need to update the database to take into account the new apps. But first, we will check if we have the latest version of Django.
sudo easy_install --upgrade djangoIf we have a look to our django powered website, we will see that it is still empty, because we have not defined any url for the moment:
chmod +x manage.py
./manage.py syncdb
./manage.py runserverLet's define the URLs by editing the urls.py file and uncommenting all lines related to the admin and admin documentation:
firefox http://127.0.0.1:8000/
# Uncomment the next two lines to enable the admin:Now, our admin site is ready:
from django.contrib import admin
admin.autodiscover()
(...)
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
firefox http://127.0.0.1:8000/admin/If you do not remember the admin password that you setup in part 2 of this tutorial (the login is root), then create a new one.
The admin portal does not display our application textModif. We have to go to textModif folder and add a file admin.py there:
cd textModifWe put the following lines in this file:
vim admin.py
from django.contrib import adminWe restart the server to see the changes (kill the associated process if you have maintained the server):
from textModif.models import *
admin.site.register(TextTask)
admin.site.register(TextOperation)
admin.site.register(TextModification)
./manage.py runserverNow we can edit our data structure through the web administration interface. Django's official tutorial shows also how to customize very easily the admin interface. We will skip this part, as I would like to focus on our web app's frontend implementation.
firefox http://127.0.0.1:8000/admin
No comments:
Post a Comment