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?
You can use the ServerAlias directive in apache for different hosts
NameVirtualHost *
<VirtualHost *>
ServerAlias pl.localhost
ServerAlias uk.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>
</VirtualHost>
but if you dont use internet domains with a configured dns you need also to update yor hosts file with the hosts you are trying to use.
yes thanks Meska,
I resolved the problem. I added to /etc/hosts
file something like:
127.0.0.1 pl.localhost
127.0.0.1 uk.localhost
127.0.0.1 www.localhost.com
精彩评论