login community faq
0
1

Hi people,

question here. Basically my structure is that I wish to serve 3 different django-powered sites for 3 types of users:

  • subdomain1.username.webfactional.com
  • user 1 subdomain2.username.webfactional.com
  • user 2 username.webfactional.com
  • publicly accessible site

I created 3 separate projects. They share data models between them. (is this correct or should I use just 1 project). In webfaction CP, I linked the above to 1 django application instance.

In httpd.conf I put

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess django processes=5 python-path=/home/carrier24sg/webapps/django:/home/carrier24sg/webapps/django/lib/python2.6 threads=1
WSGIPythonPath /home/carrier24sg/webapps/django:/home/carrier24sg/webapps/django/lib/python2.6
NameVirtualHost *:37049

<VirtualHost *:37049>
        WSGIScriptAlias / /home/username/webapps/django/myproject.wsgi
        ServerName username.webfactional.com
        ServerAlias username.webfactional.com
</VirtualHost>
<VirtualHost *:37049>
        WSGIScriptAlias / /home/carrier24sg/webapps/project/user1.wsgi
        ServerAlias user1.username.webfactional.com
</VirtualHost>

<VirtualHost *:37049>
        WSGIScriptAlias / /home/username/webapps/project/user2.wsgi
        ServerAlias user2.username.webfactional.com
</VirtualHost>

I can reach my username.webfactional.com but not the subdomains. Any steps I missed?

Qn2: How should I serve the static media for each site? Can I serve them through just one static media application that is linked to username.username.webfactional.com ?

asked Mar 13 '11 at 22:44

amateur's gravatar image

amateur
11113

edited Mar 13 '11 at 22:48


This looks generally correct.

In your httpd.conf example, you're using different paths for your WSGI files:

1
2
3
/home/username/webapps/django/myproject.wsgi
/home/username/webapps/project/user1.wsgi
/home/username/webapps/project/user2.wsgi

However, according to your description, you are using a single django project (or, "webapp"). Therefore, it would be expected that all of these would point to "/home/username/webapps/django/..."

answered Mar 13 '11 at 22:59

ryans's gravatar image

ryans ♦♦
28411420

@ryans, thanks for pointing out this. I'm sorry,made a typo mistake.Regarding q1, should I use 3 separate django projects for each subdomain or 1 django project? Also, I probably can serve the static files for all 3 sites with 1 app right?

(Mar 13 '11 at 23:09) amateur amateur's gravatar image

You would use one Django application ("webapp") for this, but you could technically use more than one Django Project (they're completely independent concepts). A Django project generally has its own WSGI file. The best way to approach the problem will depend on your particular application, but starting with a single webapp (/home/username/webapps/django/...) and a couple Django projects (each with its own WSGI file) would probably be the easiest way to start.

Also, yes, you can serve the static files for all 3 sites with one application. That shouldn't be a problem.

(Mar 13 '11 at 23:22) ryans ♦♦ ryans's gravatar image

@ryan, great, thanks for the advice.

(Mar 14 '11 at 00:35) amateur amateur's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×643
×150

Asked: Mar 13 '11 at 22:44

Seen: 1,372 times

Last updated: Mar 14 '11 at 00:35

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited