The easiest way to combine two Django projects

Best scenario: just change the urlpatterns of one of them to include the urlpatterns of the other.

But now they both have separate settings.py, separate DB, separate directories. I assume that I may have to somehow combine the two settings.py parameters, include one of them in the other INSTALLED_APPS and resolve a bunch of directory problems. Can I somehow just call another via urls.py and abandon all of the above. Any documentation on the site that describes in detail all this, which is important. Sorry if this was asked. The problem is that the existing Django project runs under one uwsgi process on the server, and adding another uwsgi process hits it at a different account level.

+4
source share
2 answers

Not sure if this is what you mean by โ€œcalling another via URLs.py,โ€ but you can easily add URLs from one application to another. For instance:

urlpatterns = patterns('', url(r'^polls/', include('polls.urls'))) 

This will include all the URLs in the polls app. You can read here:

https://docs.djangoproject.com/en/dev/intro/tutorial03/#decoupling-the-urlconfs

0
source

Now this is the state of my knowledge. Something like uwsgi, and I assume that other server circuits request a specification of one settings.py parameter as a parameter. To integrate several Django projects into one uwsgi process, they will have to share one settings.py parameter. The only problem is only one setting for MEDIA_URL and MEDIA_ROOT. And the only solution that I see is transferring media from both projects to one folder - it seems unreasonable. Did I miss something.

0
source

Source: https://habr.com/ru/post/1383949/


All Articles