New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove example.com as the default SITE in django #12
Comments
What worse, if I delete example.com from sites list I get 'Server error (500)' and installation becomes unusable. Here is what in the mailman-web logs:
|
@ulrith Yeah, you need to change the default By default the value is 1 in the container's You should change it to 2, which I suppose which would point to your domain in |
@maxking It would be better if I can replace example.com by my actual domain with some command like I mentioned in this comment. Or by sql query in database container... Can you help? |
@ulrith Yep, Django command line will drop you into a python REPL where you can do anything you wish, even to the production database ;-) maxking@mailman:~$ docker exec -it mailman-web python manage.py shell
Python 2.7.13 (default, Jun 21 2017, 18:14:15)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.db import models
>>> from django.contrib.sites.models import Site
>>> Site.objects.all()
<QuerySet [<Site: lists.araj.me>]>
>>> Site.objects.create(name='Random Domain', domain='mail.araj.me')
<Site: mail.araj.me>
>>> Site.objects.all()
<QuerySet [<Site: lists.araj.me>, <Site: mail.araj.me>]>
>>> for each in Site.objects.all():
... print(each.domain, each.id)
...
(u'lists.araj.me', 2)
(u'mail.araj.me', 3) If you need to read more about this, here is a link to Django's Sites framework. |
@maxking Actually I'm not familiar with Python. Could you please give me a code snippet (ideally one liner) which will replace Site: example.com to Site: mydomain.tld for the newly installed Mailman 3? |
OK, so as it turns out, Django creates the default So, here are your options if you want to create a new website during the startup.
The file below is saved to
Then, you run However, doing this right now with the containers is probably difficult as there is no easy way to actually run custom commands on startup (also called entrypoint in Docker terminology). I have opened a new issue #61 to track that problem.
Note that the above command is meant for django, so you need to append
This would not require any changes anywhere, but in my local testing I found out that the display name on top doesn't change unless I restart the Django server, and it will only be required for the very first time. According to me, this looks like the best option, after the first one, which I am willing to add support for in the container images. |
@maxking The last option works like a charm! Thanks |
Should be resolved. |
DEFAULT_FROM_DOMAIN environment variable now also replaces the default example.com domain. The description however isn't changed and can be changed from the Django admin site. Fixed in #95 |
Right now, when an instance comes up, the default site is set to example.com (for some reason).
Change that or add instructions to change site id to the actual domain being used.
The text was updated successfully, but these errors were encountered: