danske
danske

Reputation: 647

django on apache - admin page links are VISIBLE but not CLICKABLE

I have just deployed a django site, and upon changing the value my DEBUG variable to 'False' causes my admin page links to change from active links to simple text.

An attempt to go directly to what I know should be the URL causes a 'TemplateDoesNotExist'.

I am sure it's not a permissions issue with Apache, I feel it is something to do with my admin configuration though I have no idea what.

Upvotes: 3

Views: 459

Answers (2)

Alireza
Alireza

Reputation: 4516

I know this question's been already solved.

But in my case, coming from django 1.7 to a server that runs django 1.6, I had to add

admin.auto_discover()

to my urls.py.

Well, I had added this line to the end of urls.py and django admin was all characters ! Moving it to top up the file, above definition of urlpatterns, fixed the issue.

Hope this helps :)

Upvotes: 0

danske
danske

Reputation: 647

I figured it out. Here is a reference for anyone else who might find themselves with this problem.

I was using what must be a deprecated method of defining my Admin models - I put them all in models.py, instead of creating a separate admin.py file for each application.

When learning django, there are plenty of tutorials floating around that recommend or give examples that use this method. Apparently this is no longer a good idea (at least not as of Django 1.4). It could probably be wrangled into working with some template hacking, but it is is probably cleaner and definitely simpler to just follow the latest conventions and create the admin.py file.

I thought I was saving time by just cramming it all into one file "for now" but without some of the magical debug-only template loading, this solution failed.

Hope this saves someone some frustration!

Upvotes: 6

Related Questions