You can test the site framwork support with the developer server. For this, edit/create a local settings file and insert this:

.../PyLucidTest/PyLucid_env/src/pylucid/pylucid_project/local_settings.py

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import os

_used_port = os.environ.get("USED_PORT")
if _used_port:
    try:
        SITE_ID = int(_used_port[-2:]) + 1 # Used the last two numbers to build the ID
    except ValueError, err:
        print "Error getting site ID from %r (error: %s)" % (_used_port, err)
    else:
        print "Used port is %r -> set SITE_ID: %s" % (_used_port, SITE_ID)
else:
    SITE_ID = 1

You can start more than one developer server, e.g.:

Start with SITE_ID == 1:

1
.../PyLucidTest/PyLucid_env$ ./manage.sh runserver 8000

After this you can start a second test server on different port. Open a second terminal and start the second test server:

1
.../PyLucidTest/PyLucid_env$ ./manage.sh runserver 8001

This starts a server with SITE_ID == 2.

Important: Before you can use a SITE ID > 1 you must login (on the site with ID==1) an create the site entries in the django admin panel.
The initial database fixtures does only create site ID 1!

setup

  • go into admin panel with url 127.0.0.1:8000/admin/
  • Add a new site (domain/name e.g: "127.0.0.1:8001")

different languages

If sites should have different system default languages you can do something like this in your local_settings.py:

1
2
3
4
if SITE_ID == 1:
    LANGUAGE_CODE = "en"
elif SITE_ID == 2:
    LANGUAGE_CODE = "de"