1

Now I have apache configuration which works only with localhost domain (http://localhost/).

Alias /media/ "/ścieżka/do/instalacji/django/contrib/admin/media/"
Alias /site_media/ "/ścieżka/do/plikow/site_media/"
<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE settings
    PythonPath "['/thomas/django_projects/project'] + sys.path"
    PythonDebug On
</Location>
<Location "/site_media">
SetHandler none
</Location>

How can I make it working for some subdomains like pl.localhost or uk.localhost? This subdomains should display the same page what domain (localhost).

Second question: It is possible change default localhost address (http://localhost/) to (http://localhost.com/) or (http://www.localhost.com/) or something else?

1

Simplest and rather temporary solution is to edit your '/etc/hosts' file and add something like:

127.0.0.1        pl.localhost
127.0.0.1        uk.localhost
127.0.0.1        www.localhost.com

It works provided that '/etc/hosts' is checked before asking DNS server. It is default configuration but when it is not working check '/etc/nsswitch.conf' and change line with:

hosts: ...

to have 'files' as a first entry in a sequence.

Another, way better but more time consuming solution is to run your own bind9 name server. Also check virtual name host configuration in Apache. It simplifies things.

1
  • I'm glad to hear that. – Casual Coder May 13 '10 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.