Commit 7b05d231 authored by J08nY's avatar J08nY

Setup static files and make index page work.

parent 97164ec9
......@@ -30,7 +30,7 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# Quick-start development settings - unsuitable for production
......@@ -44,6 +44,8 @@ DEBUG = True
ALLOWED_HOSTS = []
SITE_ID = 1
# Mailman API credentials
MAILMAN_REST_API_URL = 'http://localhost:8001'
MAILMAN_REST_API_USER = 'restadmin'
......@@ -61,7 +63,22 @@ INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django_pgpmailman',
'django_mailman3',
'django_gravatar',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.openid',
'django_mailman3.lib.auth.fedora',
'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 = [
......@@ -74,7 +91,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'django_pgpmailman.urls'
ROOT_URLCONF = 'urls'
TEMPLATES = [
{
......@@ -84,15 +101,21 @@ TEMPLATES = [
'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'
],
},
},
]
WSGI_APPLICATION = 'django_pgpmailman.wsgi.application'
WSGI_APPLICATION = 'wsgi.application'
# Database
......@@ -124,6 +147,10 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
LOGIN_URL = 'account_login'
LOGIN_REDIRECT_URL = 'list_index'
LOGOUT_URL = 'account_logout'
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
......@@ -139,7 +166,12 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/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 = os.path.join(BASE_DIR, 'static')
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
......@@ -18,8 +18,7 @@
from operator import itemgetter
from django.conf import settings
from django_mailman3.lib.mailman import get_mailman_client
from mailmanclient._client import Plugin
from mailmanclient._client import Plugin, Client
from django_pgpmailman.models import PGPMailingList
......@@ -40,10 +39,13 @@ class PGPPlugin(Plugin):
entry in sorted(content['entries'], key=itemgetter('list_id'))]
def get_list(self, list_identifier):
response, content = self.call('lists/{}'.format(list_identifier))
response, content = self.call('lists/%s' % list_identifier)
return PGPMailingList(self._connection, content['self_link', content])
def get_pgp_plugin():
return PGPPlugin(
get_mailman_client().get_plugin(settings.MAILMAN_PGP_PLUGIN_NAME))
client = Client('%s/3.1' %
settings.MAILMAN_REST_API_URL,
settings.MAILMAN_REST_API_USER,
settings.MAILMAN_REST_API_PASS)
return PGPPlugin(client.get_plugin(settings.MAILMAN_PGP_PLUGIN_NAME))
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,9 +8,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block head_title %}{{ site_name|title }}{% endblock %}</title>
<link rel="shortcut icon" href="{% static 'django_pgpmailman/img/favicon.ico' %}">
<link rel="stylesheet" href="{% static 'django_pgpmailman/libs/bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'django_mailman3/css/main.css' %}">
<link rel="shortcut icon" href="{% static 'django-pgpmailman/img/favicon.ico' %}">
<link rel="stylesheet" href="{% static 'django-pgpmailman/libs/bootstrap/css/bootstrap-old.min.css' %}">
<link rel="stylesheet" href="{% static 'django-mailman3/css/main.css' %}">
</head>
<body>
......@@ -23,7 +23,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'pgp_list_index' %}"><span><img src="{% static 'django_pgpmailman/img/mailman_logo_small_trans.png' %}" /> PGPMailman</span></a>
<a class="navbar-brand" href="{% url 'pgp_list_index' %}"><span><img src="{% static 'django-pgpmailman/img/mailman_logo_small_trans.png' %}" /> PGPMailman</span></a>
</div>
<div class="collapse navbar-collapse" id="header-nav">
<ul class="nav navbar-nav">
......@@ -116,9 +116,9 @@
</div>
</footer>
<script src="{% static 'django_pgpmailman/libs/jquery/jquery-1.11.3.min.js' %}"></script>
<script src="{% static 'django_pgpmailman/libs/bootstrap/js/bootstrap.min.js' %}"></script>
<script src="{% static 'django_mailman3/js/main.js' %}"></script>
<script src="{% static 'django-pgpmailman/libs/jquery/js/jquery-old.min.js' %}"></script>
<script src="{% static 'django-pgpmailman/libs/bootstrap/js/bootstrap-old.min.js' %}"></script>
<script src="{% static 'django-mailman3/js/main.js' %}"></script>
{% block additionaljs %}{% endblock %}
</body>
</html>
......@@ -34,6 +34,7 @@
<td>{{ pgp_list.key.fingerprint }}</td>
<td>{{ mlist.settings.description }}</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
......
......@@ -22,5 +22,5 @@ from django.conf.urls import url
from django_pgpmailman.views.list import pgp_list_index
urlpatterns = [
url(r'^$', pgp_list_index)
url(r'^$', pgp_list_index, name='pgp_list_index')
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment