Giter Club home page Giter Club logo

Comments (7)

rebkwok avatar rebkwok commented on August 25, 2024

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.

bodgerbarnett avatar bodgerbarnett commented on August 25, 2024

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.

rebkwok avatar rebkwok commented on August 25, 2024

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.

bodgerbarnett avatar bodgerbarnett commented on August 25, 2024

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.

rebkwok avatar rebkwok commented on August 25, 2024

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.

rebkwok avatar rebkwok commented on August 25, 2024

Closing since this is not an issue with multisite itself

from django-multisite.

bodgerbarnett avatar bodgerbarnett commented on August 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.