I've been working with a Django app for a while, and the Django admin interface works great, except that the "View on site" link doesn't work. Whenever I try to use it, I get an OperationalError
with the message: no such table: django_site
. I've done some research into this problem, and it seems that I have to set up the Django sites framework for this link to work, but I'm exactly sure how to do that. The documentation talks about database tables, etc., but it doesn't tell how to actually set up a site. So my question is really two-fold:
./manage.py syncdb
will automagically "detect" that I want the table set up?settings.py
like SITE_ID = 2 if DEBUG else 1
, or will manage.py
just detect that I'm working on the debug site and not do anything with the sites framework?To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).
After you've taken these steps, you'll be able to use the admin site by visiting the URL you hooked it into ( /admin/ , by default). If you need to create a user to login with, use the createsuperuser command.
'django-admin' is not recognized as an internal or external command, operable program or batch file. To fix this, first close the terminal window and relaunch it with administrator privileges. Once you launch the elevated terminal window change directory to where you wish to start your Django project.
Define a get_absolute_url
on your model. The admin uses that method to figure out how to construct the objects url. See the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With