JonnyD
JonnyD

Reputation: 497

Deploying multiple Django projects, or apps?

I just got Django installed on my nginx server and deployed a project that exists at the domain's root level: mydoman.com/map. I will be building other Django projects on this server, but they will not share the same database, so they can't be different apps from the same project, right?

Can I set up some level of abstraction between my sites? Like mydomain.com/map/map_index, and mydomain.com/map/admin for the admin side? Then something like mydomain.com/votes/vote_index and mydomain.com/votes/admin for the admin side of that site?

I would want mydomain.com/map and mydomain.com/votes to be two separate projects, using the same Django instance, sharing the same site-packages folder. Both projects will need modules like django-storages and django-memcached.

Upvotes: 1

Views: 591

Answers (1)

dt0xff
dt0xff

Reputation: 1563

Mkay. First of, it is possible to build one app with multiple databases. Just FYI. But I'd suggest you to use different app. Really.

Yes, you can, easily, because nginx is so easy to use!

server {
    listen 80;
    server_name mydomain.com;

    location /one/ {
        include uwsgi_params;
        uwsgi_pass unix:/var/run/uwsgi/one.sock;
        uwsgi_read_timeout 60;
    }

    location /two/ {
        include uwsgi_params;
        uwsgi_pass unix:/var/run/uwsgi/two.sock;
        uwsgi_read_timeout 60;
    }

    ....
}

This confis assumes you are deploying with uwsgi socket-file. So you have one uwsgi-djangoapp instance on /one/ locaton(url) and different on another.

Upvotes: 1

Related Questions