It's actually quite easy to test a subdomain setup with the run server and any
web server like Apache or nginx.
I'm commonly using nginx to do this, plus a few entries in my /etc/hosts file:
127.0.0.1 some.domain.localhost
127.0.0.1 other.domain.localhost
And the nginx configuration works like this:
upstream runserver {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name some.domain.localhost
other.domain.localhost;
access_log /usr/local/var/log/nginx/domain.access.log main;
error_log /usr/local/var/log/nginx/domain.error.log;
root /Users/you/Site/domain;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
try_files $uri @django;
}
location @django {
proxy_pass $scheme://runserver;
}
}
That's it.
Cheers, Fabian
On 27.01.2013, at 02:27, Russell Keith-Magee <[email protected]> wrote:
>
> The best approach I've found is to use xip.io. xip.io is a service that is
> actually provided by the 37 Signals guys, but it works for any web project
> (not just Rails). I'll honour a good idea wherever it comes from.
>
> It's a DNS server with unusual behaviour: If you prepend an IP address to the
> start of .xip.io, it will return that IP address as the resolved IP for the
> domain.
>
> So - if you set your server running on 127.0.0.1:8000, but point your browser
> at http://127.0.0.1.xip.io:8000, it will resolve to 127.0.0.1.
>
> Then, you can use your subdomain; bob.127.0.0.1.xip.io:8000 will resolve to
> your development server, but with a request header that tells you the
> subdomain.
>
> I've found it very useful for testing subdomains.
>
> Yours,
> Russ Magee %-)
>
> On Sun, Jan 27, 2013 at 7:47 AM, Brian Dant <[email protected]> wrote:
> I'm trying to create a development environment that supports testing my
> subdomain configuration. I'll be using the django-subdomains package, which
> relies on the sites framework. To make a local environment that supports
> this while using the Django built-in webserver, do I need to set up local
> DNS? Most of the solutions I see rely on Apache, and refer to the /etc/hosts
> file. I've tried to use that, but nothing happens when I hit the name I
> think should map to 127.0.0.1:8000.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.