Tuesday, January 28, 2014

Re: Need Help Moving Database to production server

On Mon, Jan 27, 2014 at 11:51 PM, Mike Dewhirst <miked@dewhirst.com.au> wrote:
On 28/01/2014 4:51pm, Mark Phillips wrote:
I have a django project running on my laptop. I have (finally) managed
to get it to work with apache on a production server. However, I still
have a problem. When I access the admin site and login as the superuser,
I get "you don't have permission to do anything" message.

I don't think this is a Django problem because the superuser doesn't need any permissions.

I am pretty sure it is a setup problem, from moving from development to production in a different machine.
 
Presumably this is after a successful login - you don't quite specify this. 

Yes. I can login as the super user using the django admin login form, but I cannot edit or see any tables in the admin page. Just the you can't edit anything. 



To migrate the database, I did a mysqldump to a file on the development
machine, then added it to the mysql server running on the production
machine. The only change was in the database name, none of the tables
changed. Is this the problem? Or, am I missing something else.

Did you also change the database name in your production settings.py?

Yes....or I would not be able to login. 

Otherwise, I'd suspect a mismatch somewhere. For my own setups I always have the same user as the the database owner in Postgres and the superuser in Django. Dunno whether that has shielded me from this sort of problem or not.

I discovered the problem, but not the solution. I have the following lines in my urls.py - 

from django.contrib import admin
admin.autodiscover()

which work as expected in my development site. However, in my production site if I leave the admin.autodiscover() in the urls.py, I get this error message:

ImproperlyConfigured at /inventory
The included urlconf inventory_project.urls doesn't have any patterns in it 

When I comment out the admin.autodiscovery(), the site works as expected, except for the admin pages. 

So, what do I need to do to make admin.autodiscovery() work in my production site - Apache, mod_wsgi, and a virtual environment the same as my development machine?

Thanks,

Mark

hth

Mike


Thanks!

Mark

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAEqej2NgioCC8csFPhJonZtnHL7bzbdLMYaQtzPwCVcY_0fumQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/52E7535D.7030400%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEqej2MT5Xjxp-GXpY9mfahif%3D-brkWkxZWr5yo7tVUsGRfG0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment