开发者

Django: how to create sites dynamically?

I need to create an application for the company where I can create sites dynamically. For example, I need an admin interface (Django's admin is enough) where I can setup a new site and add some settings to it. Each site must hold a domain (domains can be manually added to apache conf, but if Django can 开发者_运维技巧handle it too would be awesome). Each site must be independent of the others, I mean, I shouldn't be able to see the data content of other sites but I can share same applications/models.

I've seen the Django's Sites framework, but I'm not sure if it's possible to implement that way.

Should I use Sites framework or create a new app that can handle sites better? What do you think?


The django site framework will do that, but it can't server the site according to the domain name. You'll have to do that using you server such as Apache, Nginx, etc.


If you are using Django 1.8+, there is https://bitbucket.org/levit_scs/django-polla

If you are using an older version of Django, you can use https://bitbucket.org/uysrc/django-dynamicsites/overview but it will probably require some fiddling.

What those 2 applications add compared to Django dynamic sites is the ability to easily serve sites on the same instance according to the domain name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜