your can use routers, or the directive DATABASE in separate files 
development and production with respective configuration

El lunes, 24 de septiembre de 2018, 16:18:46 (UTC-6), jim_rain escribió:
>
> Hi, 
>
> I'm developing a Django app, it's hosted on an EC2 instance so I'm using 
> wsgi, even in development. I would like to create a production and a 
> development version where really the only things that are different are the 
> two databases. I want the code to be the same on both. I figured I could 
> just have two settings files and two wsgi.py files so it's set up like this:
>
> wsgi_prod.py:
>
> *import os*
>
> *from django.core.wsgi import get_wsgi_application*
>
> *os.environ.setdefault("DJANGO_SETTINGS_MODULE", 
> "canzare.settings.production")*
>
> *application = get_wsgi_application()*
>
>
> wsgi_dev.py:
>
>
> *import os*
>
> *from django.core.wsgi import get_wsgi_application*
>
> *os.environ.setdefault("DJANGO_SETTINGS_MODULE", 
> "canzare.settings.development")*
>
> *application = get_wsgi_application()*
>
>
> Then in my httpd.conf I have these lines:
>
>
> *WSGIScriptAlias /dev /home/canzare/work_area/canzare/canzare/wsgi_dev.py*
>
> *WSGIScriptAlias / /home/canzare/work_area/canzare/canzare/wsgi_prod.py*
>
>
> The only real difference in the settings.py files is that they point to 
> two different databases in mysql. 
>
>
> This sort of works, I can access the production site with <mysite>/ and I 
> can access the development site with <mysite>/dev/
>
>
> But then everything falls apart. The admin site on both seems to be 
> broken. It looks ok but if I try to perform any actions it tries to make me 
> re-login. 
>
>
> Also (and this may be the root of the other problem) I don't think 
> migration works correctly. I can migrate to one instance but not the other. 
>
>
> Has anybody come across something like this before and/or and I'm going 
> about this completely wrong and is there a better way?
>
>
> Thanks. 
>
> Jim
>
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/41f7faca-8998-453b-8fc2-f23732a05d39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to