WebFaction
Community site: login 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

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 13 Mar '11, 22:44

amateur
1111416
accept rate: 0%

edited 13 Mar '11, 22:48


This looks generally correct.

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

/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/..."

permanent link

answered 13 Mar '11, 22:59

ryans ♦♦
5.0k93460
accept rate: 43%

@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?

(13 Mar '11, 23:09) amateur

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.

(13 Mar '11, 23:22) ryans ♦♦

@ryan, great, thanks for the advice.

(14 Mar '11, 00:35) amateur
Your answer
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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×225

question asked: 13 Mar '11, 22:44

question was seen: 4,862 times

last updated: 14 Mar '11, 00:35

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM