ecometrica / django-multisite

Multisite in django — use one Django app to serve multiple domains
BSD 3-Clause "New" or "Revised" License
138 stars 42 forks source link

general chicken-egg problem #33

Open jedie opened 8 years ago

jedie commented 8 years ago

The DynamicSiteMiddleware will always raise 404 if he can't find the current Domain in the Alias model. But i can't login and use the admin panel, if i always get a 404...

Set MULTISITE_FALLBACK will not really help here.

So i have to deactivate DynamicSiteMiddleware, login and insert the current Domain and activate DynamicSiteMiddleware ?!?

jedie commented 8 years ago

I made a simple view to create a multisite.models.Alias entry for the current host with the default SITE_ID.

See: https://github.com/jedie/PyLucid/blob/7cd404f709a5e56846e064fbbe6a9578d2b93bb8/pylucid/multisite_views.py#L9-L28

I can contribute this via pull request.

avoine commented 8 years ago

Similar problem here but I get into an infinite loop instead of a 404.

mghughes commented 8 years ago

Hey @jedie - to be fair you could manually add the domain from a python or db shell in that situation, but point taken :)

We'd welcome a PR for that view! I don't think we should neccessarily change the default fallback behaviour, but it could be useful to have that view around as an out-of-the-box option.