From c110bb1d01a53a89eace35fea7e5b8a93e8d092b Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Wed, 29 Mar 2017 16:30:25 -0700 Subject: [PATCH] Add a docker compose configuration and mailman-web This commit adds a lot of new code including the mailman's web frontend. It includes a configuration file which can later be configured to run required configs. Also, the docker-compose file spins off the containers, sets up appropriate volumes and links. --- .gitignore | 3 + core/Dockerfile | 2 + core/assets/mailman.cfg | 12 +- core/assets/run.sh | 2 +- docker-compose.yaml | 22 ++ web/Dockerfile | 35 +++ web/mailman-web/README.rst | 9 + web/mailman-web/__init__.py | 0 web/mailman-web/manage.py | 10 + web/mailman-web/settings.py | 488 ++++++++++++++++++++++++++++++++++++ web/mailman-web/urls.py | 35 +++ web/mailman-web/wsgi.py | 38 +++ 12 files changed, 651 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 docker-compose.yaml create mode 100644 web/Dockerfile create mode 100644 web/mailman-web/README.rst create mode 100644 web/mailman-web/__init__.py create mode 100755 web/mailman-web/manage.py create mode 100644 web/mailman-web/settings.py create mode 100644 web/mailman-web/urls.py create mode 100755 web/mailman-web/wsgi.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9403d17 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*/.sass-cache/* +*.log +*.log diff --git a/core/Dockerfile b/core/Dockerfile index a31604c..ab1f2a1 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -15,4 +15,6 @@ ADD assets/pidproxy.py /opt/pidproxy.py # Change the working directory. WORKDIR /opt/mailman +EXPOSE 8001 + CMD /opt/run.sh diff --git a/core/assets/mailman.cfg b/core/assets/mailman.cfg index cd3c952..936a2fe 100644 --- a/core/assets/mailman.cfg +++ b/core/assets/mailman.cfg @@ -1,7 +1,11 @@ -[devmode] -enabled: yes -testing: yes -recipient: you@yourdomain.com +# [devmode] +# enabled: yes +# testing: yes +# recipient: you@yourdomain.com + +[webservice] +hostname: 0.0.0.0 + [mta] smtp_port: 9025 diff --git a/core/assets/run.sh b/core/assets/run.sh index 65f7363..6495c8c 100755 --- a/core/assets/run.sh +++ b/core/assets/run.sh @@ -8,4 +8,4 @@ fi # Run mailman using the pidproxy command which spawns off mailman # and forwards any signal you send it to the master runner in mailman. -/opt/pidproxy.py /opt/mailman/var/master.pid mailman -C /opt/mailman/mailman.cfg start +/opt/pidproxy.py /opt/mailman/var/master.pid mailman -C /opt/mailman/mailman.cfg start --force diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..9ca66de --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,22 @@ +version: '2' +services: + mailman-core: + build: + context: ./core + image: mailman-core:latest + container_name: mailman-core + volumes: + - /opt/mailman/core:/opt/mailman/ + mailman-web: + build: + context: ./web + image: mailman-web:latest + container_name: mailman-web + ports: + - "8000:8000" + depends_on: + - mailman-core + links: + - mailman-core:mailman-core + volumes: + - /opt/mailman/web:/opt/mailman-web-data diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..7915726 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,35 @@ +FROM python:2.7 + +MAINTAINER Abhilash Raj + +RUN apt-get update \ + && apt-get install -y ruby-sass \ + git \ + && python -m pip install git+https://gitlab.com/mailman/mailmanclient.git \ + git+https://gitlab.com/mailman/postorius.git \ + git+https://gitlab.com/mailman/django-mailman3.git \ + git+https://gitlab.com/mailman/hyperkitty.git \ + whoosh \ + uwsgi + + +ADD mailman-web /opt/mailman-web + +WORKDIR /opt/mailman-web + +EXPOSE 8000 + +# ENV DJANGO_SETTINGS_MODULE=mailman-web.settings + +ENV UWSGI_WSGI_FILE=wsgi.py UWSGI_HTTP=:8000 UWSGI_WORKERS=2 \ + UWSGI_THREADS=4 + +CMD python manage.py collectstatic --noinput \ + && python manage.py migrate \ + && uwsgi --http-auto-chunked --http-keepalive + +#ADD assets/run.sh /opt/run.sh + +#ENTRYPOINT /opt/run.sh + +# CMD ["uwsgi", "--http-auto-chunked", "--http-keepalive"] diff --git a/web/mailman-web/README.rst b/web/mailman-web/README.rst new file mode 100644 index 0000000..860c977 --- /dev/null +++ b/web/mailman-web/README.rst @@ -0,0 +1,9 @@ +============================= +Mailman Suite example project +============================= + +This example project is meant to give you a quick development setup for using +both Hyperkitty and Postorius in a single Django instance, providing you a +web interface for Mailman 3 configuration and web access to the archives. + + diff --git a/web/mailman-web/__init__.py b/web/mailman-web/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/web/mailman-web/manage.py b/web/mailman-web/manage.py new file mode 100755 index 0000000..f9726f9 --- /dev/null +++ b/web/mailman-web/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/web/mailman-web/settings.py b/web/mailman-web/settings.py new file mode 100644 index 0000000..bbdc97a --- /dev/null +++ b/web/mailman-web/settings.py @@ -0,0 +1,488 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. +# +# This file is part of Mailman Suite. +# +# Mailman Suite is free sofware: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# Mailman Suite is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU General Public License along +# with Mailman Suite. If not, see . +""" +Django Settings for Mailman Suite (hyperkitty + postorius) + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.8/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'change-this-on-your-production-server' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ADMINS = ( + ('Mailman Suite Admin', 'root@localhost'), +) + +SITE_ID = 1 + +# Hosts/domain names that are valid for this site; required if DEBUG is False +# See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts +ALLOWED_HOSTS = [ + "localhost", # Archiving API from Mailman, keep it. + # "lists.your-domain.org", + # Add here all production URLs you may have. +] + +# Mailman API credentials +MAILMAN_REST_API_URL = 'http://mailman-core:8001' +MAILMAN_REST_API_USER = 'restadmin' +MAILMAN_REST_API_PASS = 'restpass' +MAILMAN_ARCHIVER_KEY = 'SecretArchiverAPIKey' +MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') + +# Application definition + +INSTALLED_APPS = ( + 'hyperkitty', + 'postorius', + 'django_mailman3', + # Uncomment the next line to enable the admin: + 'django.contrib.admin', + # Uncomment the next line to enable admin documentation: + # 'django.contrib.admindocs', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'rest_framework', + 'django_gravatar', + 'paintstore', + 'compressor', + 'haystack', + 'django_extensions', + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'django_mailman3.lib.auth.fedora', + 'allauth.socialaccount.providers.openid', + 'allauth.socialaccount.providers.github', + 'allauth.socialaccount.providers.gitlab', + 'allauth.socialaccount.providers.google', + #'allauth.socialaccount.providers.facebook', + #'allauth.socialaccount.providers.twitter', + #'allauth.socialaccount.providers.stackexchange', +) + + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.middleware.locale.LocaleMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', + 'django_mailman3.middleware.TimezoneMiddleware', + 'postorius.middleware.PostoriusMiddleware', +) + +ROOT_URLCONF = 'urls' + + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.template.context_processors.csrf', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + 'django_mailman3.context_processors.common', + 'hyperkitty.context_processors.common', + 'postorius.context_processors.postorius', + ], + }, + }, +] + +WSGI_APPLICATION = 'wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + # Use 'sqlite3', 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'ENGINE': 'django.db.backends.sqlite3', + # DB name or path to database file if using sqlite3. + 'NAME': '/opt/mailman-web-data/mailmansuite.db', + # The following settings are not used with sqlite3: + 'USER': 'mailmansuite', + 'PASSWORD': 'mmpass', + # HOST: empty for localhost through domain sockets or '127.0.0.1' for + # localhost through TCP. + 'HOST': '', + # PORT: set to empty string for default. + 'PORT': '', + } + # Example for PostgreSQL (recommanded for production): + #'default': { + # 'ENGINE': 'django.db.backends.postgresql_psycopg2', + # 'NAME': 'database_name', + # 'USER': 'database_user', + # 'PASSWORD': 'database_password', + # 'HOST': 'localhost', + #} +} + + +# If you're behind a proxy, use the X-Forwarded-Host header +# See https://docs.djangoproject.com/en/1.8/ref/settings/#use-x-forwarded-host +# USE_X_FORWARDED_HOST = True + +# And if your proxy does your SSL encoding for you, set SECURE_PROXY_SSL_HEADER +# https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header +# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_SCHEME', 'https') + +# Other security settings +# SECURE_SSL_REDIRECT = True +# If you set SECURE_SSL_REDIRECT to True, make sure the SECURE_REDIRECT_EXEMPT +# contains at least this line: +# SECURE_REDIRECT_EXEMPT = [ +# "archives/api/mailman/.*", # Request from Mailman. +# ] +# SESSION_COOKIE_SECURE = True +# SECURE_CONTENT_TYPE_NOSNIFF = True +# SECURE_BROWSER_XSS_FILTER = True +# CSRF_COOKIE_SECURE = True +# CSRF_COOKIE_HTTPONLY = True +# X_FRAME_OPTIONS = 'DENY' + + +# Password validation +# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': +'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': +'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': +'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': +'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +# Internationalization +# https://docs.djangoproject.com/en/1.8/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.8/howto/static-files/ + +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/var/www/example.com/static/" +STATIC_ROOT = '/opt/mailman-web-data/static' + +# URL prefix for static files. +# Example: "http://example.com/static/", "http://static.example.com/" +STATIC_URL = '/static/' + +# Additional locations of static files +STATICFILES_DIRS = ( + # Put strings here, like "/home/html/static" or "C:/www/django/static". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + # BASE_DIR + '/static/', +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + # 'django.contrib.staticfiles.finders.DefaultStorageFinder', + 'compressor.finders.CompressorFinder', +) + +# Django 1.6+ defaults to a JSON serializer, but it won't work with +# django-openid, see +# https://bugs.launchpad.net/django-openid-auth/+bug/1252826 +SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' + + +LOGIN_URL = 'account_login' +LOGIN_REDIRECT_URL = 'list_index' +LOGOUT_URL = 'account_logout' + + +# If you enable internal authentication, this is the address that the emails +# will appear to be coming from. Make sure you set a valid domain name, +# otherwise the emails may get rejected. +# https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email +# DEFAULT_FROM_EMAIL = "mailing-lists@you-domain.org" +DEFAULT_FROM_EMAIL = 'postorius@localhost.local' + +# If you enable email reporting for error messages, this is where those emails +# will appear to be coming from. Make sure you set a valid domain name, +# otherwise the emails may get rejected. +# https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-SERVER_EMAIL +# SERVER_EMAIL = 'root@your-domain.org' +SERVER_EMAIL = 'root@localhost.local' + +# Change this when you have a real email backend +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +# Compatibility with Bootstrap 3 +from django.contrib.messages import constants as messages # flake8: noqa +MESSAGE_TAGS = { + messages.ERROR: 'danger' +} + + +# +# Social auth +# +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'allauth.account.auth_backends.AuthenticationBackend', +) + +# Django Allauth +ACCOUNT_AUTHENTICATION_METHOD = "username_email" +ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_VERIFICATION = "mandatory" +# You probably want https in production, but this is a dev setup file +ACCOUNT_DEFAULT_HTTP_PROTOCOL = "http" +ACCOUNT_UNIQUE_EMAIL = True + +SOCIALACCOUNT_PROVIDERS = { + 'openid': { + 'SERVERS': [ + dict(id='yahoo', + name='Yahoo', + openid_url='http://me.yahoo.com'), + ], + }, + 'google': { + 'SCOPE': ['profile', 'email'], + 'AUTH_PARAMS': {'access_type': 'online'}, + }, + 'facebook': { + 'METHOD': 'oauth2', + 'SCOPE': ['email'], + 'FIELDS': [ + 'email', + 'name', + 'first_name', + 'last_name', + 'locale', + 'timezone', + ], + 'VERSION': 'v2.4', + }, +} + + +# +# Gravatar +# https://github.com/twaddington/django-gravatar +# +# Gravatar base url. +# GRAVATAR_URL = 'http://cdn.libravatar.org/' +# Gravatar base secure https url. +# GRAVATAR_SECURE_URL = 'https://seccdn.libravatar.org/' +# Gravatar size in pixels. +# GRAVATAR_DEFAULT_SIZE = '80' +# An image url or one of the following: 'mm', 'identicon', 'monsterid', +# 'wavatar', 'retro'. +# GRAVATAR_DEFAULT_IMAGE = 'mm' +# One of the following: 'g', 'pg', 'r', 'x'. +# GRAVATAR_DEFAULT_RATING = 'g' +# True to use https by default, False for plain http. +# GRAVATAR_DEFAULT_SECURE = True + +# +# django-compressor +# https://pypi.python.org/pypi/django_compressor +# +COMPRESS_PRECOMPILERS = ( + ('text/less', 'lessc {infile} {outfile}'), + ('text/x-scss', 'sass -t compressed {infile} {outfile}'), + ('text/x-sass', 'sass -t compressed {infile} {outfile}'), +) +# On a production setup, setting COMPRESS_OFFLINE to True will bring a +# significant performance improvement, as CSS files will not need to be +# recompiled on each requests. It means running an additional "compress" +# management command after each code upgrade. +# http://django-compressor.readthedocs.io/en/latest/usage/#offline-compression +# COMPRESS_OFFLINE = True + +# Needed for debug mode +# INTERNAL_IPS = ('127.0.0.1',) + + +# +# Full-text search engine +# +HAYSTACK_CONNECTIONS = { + 'default': { + 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', + 'PATH': os.path.join(BASE_DIR, "fulltext_index"), + # You can also use the Xapian engine, it's faster and more accurate, + # but requires another library. + # http://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#xapian + # Example configuration for Xapian: + #'ENGINE': 'xapian_backend.XapianEngine' + }, +} + + +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error when DEBUG=False. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'file':{ + 'level': 'INFO', + #'class': 'logging.handlers.RotatingFileHandler', + 'class': 'logging.handlers.WatchedFileHandler', + 'filename': os.path.join(BASE_DIR, 'logs', 'mailmansuite.log'), + 'formatter': 'verbose', + }, + 'console': { + 'class': 'logging.StreamHandler', + 'formatter': 'simple', + }, + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins', 'file'], + 'level': 'ERROR', + 'propagate': True, + }, + 'django': { + 'handlers': ['file'], + 'level': 'ERROR', + 'propagate': True, + }, + 'hyperkitty': { + 'handlers': ['file'], + 'level': 'DEBUG', + 'propagate': True, + }, + 'postorius': { + 'handlers': ['console', 'file'], + 'level': 'INFO', + }, + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s' + }, + 'simple': { + 'format': '%(levelname)s %(message)s' + }, + }, + #'root': { + # 'handlers': ['file'], + # 'level': 'INFO', + #}, +} + + +# Using the cache infrastructure can significantly improve performance on a +# production setup. This is an example with a local Memcached server. +#CACHES = { +# 'default': { +# 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', +# 'LOCATION': '127.0.0.1:11211', +# } +#} + + +# When DEBUG is True, don't actually send emails to the SMTP server, just store +# them in a directory. This way you won't accidentally spam your mailing-lists +# while you're fiddling with the code. +if DEBUG == True: + EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' + EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'emails') + + +# +# HyperKitty-specific +# + +# Only display mailing-lists from the same virtual host as the webserver +FILTER_VHOST = False + + +try: + from settings_local import * +except ImportError: + pass diff --git a/web/mailman-web/urls.py b/web/mailman-web/urls.py new file mode 100644 index 0000000..a6b9174 --- /dev/null +++ b/web/mailman-web/urls.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. +# +# This file is part of Postorius. +# +# Postorius is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# Postorius is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# Postorius. If not, see . + + +from django.conf.urls import include, url +from django.contrib import admin +from django.core.urlresolvers import reverse_lazy +from django.views.generic import RedirectView + +urlpatterns = [ + url(r'^$', RedirectView.as_view( + url=reverse_lazy('list_index'), + permanent=True)), + url(r'^postorius/', include('postorius.urls')), + url(r'^hyperkitty/', include('hyperkitty.urls')), + url(r'', include('django_mailman3.urls')), + url(r'^accounts/', include('allauth.urls')), + # Django admin + url(r'^admin/', include(admin.site.urls)), +] diff --git a/web/mailman-web/wsgi.py b/web/mailman-web/wsgi.py new file mode 100755 index 0000000..8e59cd8 --- /dev/null +++ b/web/mailman-web/wsgi.py @@ -0,0 +1,38 @@ +""" +WSGI config for HyperKitty project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/ +""" + +import os + +# import sys +# import site + +# For some unknown reason, sometimes mod_wsgi fails to set the python paths to +# the virtualenv, with the 'python-path' option. You can do it here too. +# +# # Remember original sys.path. +# prev_sys_path = list(sys.path) +# # Add here, for the settings module +# site.addsitedir(os.path.abspath(os.path.dirname(__file__))) +# # Add the virtualenv +# venv = os.path.join(os.path.abspath(os.path.dirname(__file__)), +# '..', 'lib', 'python2.6', 'site-packages') +# site.addsitedir(venv) +# # Reorder sys.path so new directories at the front. +# new_sys_path = [] +# for item in list(sys.path): +# if item not in prev_sys_path: +# new_sys_path.append(item) +# sys.path.remove(item) +# sys.path[:0] = new_sys_path + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + +application = get_wsgi_application()