Questions tagged [django-hosts]

Django-hosts is a library and recognized third-party package on Django's official website that allows for easy routing of web-app sections to different or multiple sub-domains. Use this tag for questions regarding direct implementation of django-hosts specifically.

What is django-hosts?

django-hosts is a library and recognized third-party package on Django's official website that allows for easy routing of web-app sections to different or multiple sub-domains.

The library's official documentation can be found here. The project GitHub can be found here.


Example use cases

Say for instance you own the domain mywebsite.com and as a part your web project design, you want to serve specific content at <sub-domain-1>.mywebsite.com & <sub-domain-2>.mywebsite.com.

This allows your web project to use domains like:

help.mywebsite.com

mobile.mywebsite.com

Your project can also use "user specific sub-domains" such as:

zeke.mywebsite.com

elizabeth.mywebsite.com

These techniques can give a web project better looking and more organized path structure.


Where to learn more

Below are some links to learn more about django-hosts and how to utilize it in your Django projects.

23 questions
2
votes
0 answers

django_host raising 'accounts' is not a registered namespace error

I implemented django_hosts in my project and followed all the basics as documented here, everything seemed perfect until I started using the {% load hosts %} and {% host_url 'accounts:login' host 'accounts' %} template tags to reverse URLs just as…
phagyrhe
  • 167
  • 1
  • 14
2
votes
2 answers

How to use django-hosts with Nginx

I have created one Django app which has two apps named "api" and "consumer". Now I want to use subdomains for both of this app. Like api.server.com and server.com. I searched online and found django-hosts so I implemented in my localhost and its…
Rahulsinh
  • 41
  • 1
  • 6
2
votes
1 answer

How to log in on API-level with django-hosts subdomain and DRF

I'm using django-rest-framework (DRF) to have a browsable API which shall be available under the api subdomain e.g. api.localhost:8000. To serve subdomains, I'm using django-hosts. I'm having trouble to achieve login and logout functionality on API…
robinki
  • 362
  • 3
  • 18
1
vote
0 answers

Application error after deploy django app on heroku

I have successfully built and deployed my DJANGO app on the HEROKU. During building the application collectstatic also is running smoothly. But after everything completed successfully when I tries to open my app it is showing me application error. I…
smit patel
  • 21
  • 3
1
vote
2 answers

How to serve media files correctly in django subdomains (using django-hosts) in development?

I have this model Blog and using it in 'blog' subdomain created with 'django-hosts'. My subdomains in 'hosts.py': from django.conf import settings from django_hosts import patterns, host host_patterns = patterns('', host(r'blog', 'blog.urls',…
Ehsan B
  • 36
  • 1
  • 4
1
vote
1 answer

Has anyone successfully used Reverse with namespaces, rest_framework and host patterns?

I have literally been trying to solve/ignore this issue for months now but I cannot test properly nor move on until I do. I've tried using namespaces and hard-coding but I still get the same error. 'django.urls.exceptions.NoReverseMatch: 'users' is…
Kappalucky
  • 21
  • 2
1
vote
1 answer

Django2: How to share 'request.user' with localhost:8000 and subdomain analysis.localhost:8000?

i am building a blog using Django, and i have implemented an analysis tool that allows me to plot details about my visitors (country_origin, device, browser, ...). analysis.localhost:8000 is a subdomain of localhost , defined as a class based view…
Django DO
  • 167
  • 3
  • 13
1
vote
0 answers

Django_hosts integration produces 'NoReverseMatch at /en/api/' when attempting to access api

I'm in the process of integrating Django_hosts. I have the front end URLs and the admin URLs successfully integrated and working, but my REST API URLs are still inaccessible due to this error: 'NoReverseMatch at /en/api/' The error is traced to…
user9727749
1
vote
2 answers

django.core.exceptions.ImproperlyConfigured: WSGI application 'netfacer.wsgi.application' could not be loaded; Error importing module

I am just a beginner in django . I tried to create sub-domain by following this link. When I run my project it shows the following error django.core.exceptions.ImproperlyConfigured: WSGI application 'netfacer.wsgi.application' could not be…
JESLIN
  • 159
  • 1
  • 2
  • 14
1
vote
1 answer

host-specific request breaks unrelated test cases

I have the following tests: from django.test import TestCase from django.core.urlresolvers import reverse class TestA(TestCase): def test_a(self): reverse('view1') class TestB(TestCase): def test_b(self): …
phihag
  • 278,196
  • 72
  • 453
  • 469
0
votes
2 answers

Allow locally hosted Django App Access over WAN

I am currently working on developing a webapp and working with a partner on the other side of the state. I would like to allow them to access the webapp for testing and development purposes but cant seem to be able to figure out how to get the…
Chup91
  • 66
  • 7
0
votes
0 answers

Best solution to integrate independent applications into a Django (& React) platform?

I have a general platform that I want to evolve. The platform is hosted on a domain like "https://www.example.com". For certain specific users, I would like to give them access to a completely independent application (several applications,…
0
votes
1 answer

How to run django app on windows server ec2 instance with mysql database and costum domain

I have Copied my files to the server and also setup the domain in the route 53 and also installed the xampp server now When i try starting the server with the command Python manage.py runserver 0.0.0.0:80 it gives me the following error Error:…
0
votes
0 answers

I am creating an jobsearch website in django. where jobseekers can find jobs and recruiters can post the jobs,

I have three diffrent apps in my django project, Home, jobseeker and recruiter. and each app have different subdomain. Home => localhost:8000, jobseeker => jobseeker.localhost.8000, and for recruiter => recruiter.localhost:8000. i have an…
0
votes
0 answers

custom error handler django when using django-hosts

I have a system that has deployed django-hosts, all is working fine. Until now I have been handling 404 and 500 errors for production by utilizing the neat trick of just placing files 500.html and 404.html in the root of the templates folder. This…
Paul West
  • 81
  • 8
1
2