Need Help Moving Database to production server

瀏覽次數:32 次
跳到第一則未讀訊息

Mark Phillips

未讀,
2014年1月28日 凌晨12:51:182014/1/28
收件者:django users
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. 

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.

Thanks!

Mark

Mike Dewhirst

未讀,
2014年1月28日 凌晨1:51:092014/1/28
收件者:django...@googlegroups.com
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. Presumably this is after a successful login - you
don't quite specify this.

>
> 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?

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.

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...@googlegroups.com.
> To post to this group, send email to django...@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.

Mark Phillips

未讀,
2014年1月28日 上午11:15:442014/1/28
收件者:django users
On Mon, Jan 27, 2014 at 11:51 PM, Mike Dewhirst <mi...@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
--
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...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

Alex Mandel

未讀,
2014年1月28日 下午4:57:142014/1/28
收件者:django...@googlegroups.com
Did you enable the admin in the settings.py and urls.py of the
production server?

Thanks,
Alex

Mark Phillips

未讀,
2014年1月28日 下午5:20:142014/1/28
收件者:django users
As far as I know, I did. The code base runs on the development machine, and I did not make any changes to it for the production machine.  

Thanks,

Mark 

Babatunde Akinyanmi

未讀,
2014年1月29日 清晨5:03:082014/1/29
收件者:Django users

Replies are inline

What was the result  of your investigation concerning what autodiscover complained about? Did you check your inventory_project.urls module?

回覆所有人
回覆作者
轉寄
0 則新訊息