1

Because I've heard you can host multiple websites on one VPS so I was trying to implement it, with django ( not installed in VEnvironment ), and using mod_wsgi with apache.

When I first got this VPS I was really getting started with the django, and following some tutorials from django official site, I got it to work now the problems are as follows -

1. Different Tutorials assuming different directory structures for apache the structure I got after installing apache on my Ubuntu server that I bought from digiocean with one click django setup, is like this.

/etc/apache2/

   |-- apache2.conf
   |       `--  ports.conf
   |-- mods-enabled
   |       |-- *.load
   |       `-- *.conf
   |-- conf-enabled
   |       `-- *.conf
   `-- sites-enabled
           `-- *.conf

following the tutorial ( official ) I got my first project ( site1 ) to work. Now I have this new site and that is also based on django. So I thought maybe there could be a decent way of hosting both of them under one hood.

2. many .conf files in apache

I know this might sound like a lame question but as I was reading django on apache with mod_wsgi I found instructions telling that I have to do changes in the httpd.conf file left me wondering why are there any vhost files in the sites-available folder.

3. Difference between hosting two sites say (.php ) based and django

I read there are a lot of reference about the DocumentRoot configuration under the VirtualHost configuration, while I have all my document under

/home/django/

if there is a difference between hosting two sites other than django than maybe someone would be kind enough to answer.

Now Coming to the point

a. should I move my project folder to /var/www/ if so why and will symlinks do the trick

b. as the django tutorial suggested I should configure WSGISCriptAlias and other settings in httpd.conf, Should I go with this or what should I do, this Is really important for me to understand maybe someone could point me in the direction where I could learn about it.

c. I have one systemwide installation of django does that effect in virtual hosting.

d. should I use different ports to run different websites and if yes how would I configure that.

e. Suggest me an approach that is tested with apache and mod_wsgi ( please )

Thanks in advance.

naveen.panwar
  • 393
  • 11
  • 21

1 Answers1

0

I'll try to be as laconic as possible.

  1. You really need to read docs (and even this) and the more you read the better it'll be, since you won't get here an explicit answer on how to serve django-sites on apache with details and examples.
  2. There your project live is up to you, in other words it should not be necessarily placed to /var/www/
  3. In order to hold 2+ django projects at once try to use separate wsgi daemon processes. Have a look. This will not allow different applications to interfere with each other. And yet, I would recommend to set configs for your projects (as vhosts) in /etc/apache2/sites-available files (one per file, typically).
  4. I would strongly recommend you not to work with globally installed django, but to have a separate for each project (using venv or in some other way depends to you). This way you'll make the process of upgrading packages and django much more secure.
Community
  • 1
  • 1
chem1st
  • 1,624
  • 1
  • 16
  • 22