How to test sub-domains in my localhost?
See original GitHub issueI set up django-subdomains following this [guide][1].
I set my subdomain urlconfs as follows:
SUBDOMAIN_URLCONFS = {
None: 'mysite.urls',
'www': 'mysite.urls',
'shop': 'mysite.urls.shop',
'blog': 'mysite.urls.blog'
}
Everything works nicely, but I can’t really test it cause when I run my app on my local host using python manage.py runserver
, I can’t really add the subdomains. If go to http://blog.127.0.0.1:8000, then the browser says a server cannot be found. Is there any way to set my server in such a way that allows for testing?
I also have this following line in my console: No handlers could be found for logger “subdomains.middleware”
How can I get this working? If anyone wants, my settings.py file can be found here:
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Add subdomain to localhost URL - Stack Overflow
First navigate to /mnt/c/Windows/System32/drivers/etc (Navigate cause, you may find more interesting files. Don't play here, but see what do they do) · Then...
Read more >Setting up subdomains on localhost - Server Fault
You need to set your /etc/hosts or C:\Windows\system32\drivers\etc\hosts (as administrator) to reflect the "subdomain".
Read more >Subdomain error: localhost.com and subdomain-test ... - Drupal
Hi, I'm in need of a desperate help to resolve this sub domain error. My main domain and subdomain has different ip address...
Read more >How to Set Up HTTPS and Subdomains on Localhost With ...
Learn how to use Caddy Server to set up SSL and subdomain support for your local development environment.
Read more >Local Domain & Subdomain Testing in Mac & Linux - Blog Post
sudo nano /etc/hosts You should see something like: Copy ## # Host Database # # localhost is used to configure the loopback interface ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
then you need to modify /etc/hosts file
it should work
Note: django-subdomains doesn’t has support for django1.10. for that I have made a pull request… so django version should be under 1.9 for now 😃
I did. Make sure you follow the directions on the docs. Adding the middleware before common. Then you must include Django.contrib.sites in your apps and then do run Python manage.py migrate. Finally the after adding the settings they provide in the docs to your settings file you’ll need to access the database and change the value of entry 1 in the “django_sites” table to reflect what local domain you have set up. So change “example.com” to “mysite.app” or whatever you use. This is the ticket. The subdomains will not recognize if you don’t have this site set and SITE = 1 in your settings.
I set this up like 4 times correctly since I posted this. So message me if you have any other problems.