Comments (7)
Do you mean that you have a custom template subfolders in your top-level templates dir that you've named 'example.com' and I guess you are looking for templates to render in your views by {site.domain}/foo.html
?
Can you keep the domain for your site as it is (example.com) and create an alias with
the domain you want to use for local development (example.com.local)? Then your template lookup will remain the same, because your site domain is still example.com.
from django-multisite.
I'm not sure what you mean by "create an alias with the domain you want to use for local development" in this case?
from django-multisite.
Create an alias in the django admin. Or:
site = Site.objects.create(name='example site', domain='example.com')
alias = Alias.objects.create(site=site, domain='example.com.local')
Use url example.com.local for your local development; since it is an alias for example.com, your template lookups that are based on site.domain
will still point to the same location.
I'm not sure why you need to append .local to your site domains for local development, but this will allow you to use a different url locally but keep the site domain the same. In my local development with multisite, I just add an entry in my /etc/hosts
file for the site domain, as described in the README.
from django-multisite.
OK, I will try the alias thing, thanks.
The reason I use .local for local development (rather than using /etc/hosts) is that if I use /etc/hosts, that removes access to the real domain so I can't check the actual live site at any point, without editing the hosts file. Maybe there's a way round that but I'm not aware of one.
from django-multisite.
Assuming you are running a local django server and accessing it at http://example.com:8000 (or whatever port you are running on), adding it to /etc/hosts doesn't prevent you using the real domain (without specified port). If you also have some sort of local nginx setup or similar so you access your local domain without a port, the alias thing will hopefully work for you.
from django-multisite.
Closing since this is not an issue with multisite itself
from django-multisite.
Yup, fair enough. The odd thing though, is that if I put example.com in the /etc/hosts file, it resolves to 127.0.0.1 for the real domain as well as the example.com:8000 (local dev) one. I guess I must be doing something wrong.
from django-multisite.
Related Issues (20)
- Incorrect cache prefix documentation HOT 2
- Remove template.loaders.cached.py HOT 1
- Doesn't work with django_debug_toolbar HOT 1
- django-multisite how to set the correct database for the site based on subdomain HOT 1
- remove deprecated PathAssistedCurrentSiteManager HOT 1
- Support django 2.0
- KeyError at / 1 HOT 8
- Resolve normalized domain names
- Advantages of django-multisite HOT 1
- AliasInline should override `get_queryset`, not `queryset`
- New PyPi release HOT 2
- What current version of Django does this support? HOT 2
- suggest running `black` formatter on code before push HOT 1
- Middleware compatibility with Django 2 HOT 1
- Request for an example
- Crash on tldextract==3.0.0
- Django 3.2 breaks django-multisite: The SITE_ID setting must be an integer HOT 7
- Template loader alters path, can't find template again
- About Django 3.2 support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-multisite.