--- /dev/null
+This is the Debian README for tweet-django
+
+Before using tweet-django, please configure it. The configuration file is located in /etc/tweet-django/settings.py
+You will probably need to edit the following settings:
+
+ALLOWED_HOSTS: Add the host name your web server is reachable as
+LANGUAGE_CODE, TIME_ZONE, etc: Edit to taste
+TWEET_OAUTH_*: Please register your application instance with Twitter and fill in the credentials here
+TWEET_MAPQUEST_API_KEY: Please register with MapQuest and fill in the API key here
++
++Also have a look at /etc/apache2/conf-enabled/tweet-django. You may want to change the URL path the
++application is made available at (by default /tweet-django/tweet/), or have the application only
++available in one (or more) virtual hosts, or add an extra alias.
++
++After configuring, you will need to (re)start the streaming tweet daemon:
++# systemctl restart tweet-django
++and the Apache web server:
++# systemctl restart apache2
--- /dev/null
- @@ -109,35 +106,7 @@
+Description: Patch settings to fit in Debian system
+Author: Jan-Pascal van Best <janpascal@vanbest.org>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/tweet_django/settings.py
++++ b/tweet_django/settings.py
+@@ -20,13 +20,10 @@
+ # Quick-start development settings - unsuitable for production
+ # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
+
+-# SECURITY WARNING: keep the secret key used in production secret!
+-SECRET_KEY = 'gho@vr!guh#ylqdi4(voavn+*lzyvm&91xnz9c-x6yol5ye%s='
+-
+ # SECURITY WARNING: don't run with debug turned on in production!
+-DEBUG = True
++DEBUG = False
+
+-ALLOWED_HOSTS = []
++ALLOWED_HOSTS = ['127.0.0.1']
+
+
+ # Application definition
+@@ -57,7 +54,7 @@
+ TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+- 'DIRS': [],
++ 'DIRS': ['/usr/share/tweet-django/templates'],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
- @@ -151,19 +120,31 @@
++@@ -109,41 +106,21 @@
+ # Static files (CSS, JavaScript, Images)
+ # https://docs.djangoproject.com/en/1.9/howto/static-files/
+
+-STATIC_URL = '/static/'
+-
+-# Application specific settings
+-
+-TWEET_BASEPATH = 'results'
+-
+-
+-config = ConfigParser()
+-config.read(os.path.join(BASE_DIR, 'tweet_django', 'local.ini'))
+-
+-DATABASES = {
+- 'default': {
+- 'ENGINE': config.get('database', 'ENGINE'),
+- 'NAME': config.get('database', 'NAME'),
+- 'USER': config.get('database', 'USER'),
+- 'PASSWORD': config.get('database', 'PASSWORD'),
+- 'HOST': config.get('database', 'HOST'),
+- 'OPTIONS': {'charset': 'utf8mb4'},
+- }
+-}
+-
+-TWEET_BASEPATH = config.get('paths', 'TWEET_BASEPATH')
+-
+-TWEET_OAUTH_CONSUMER_KEY = config.get('twitter', 'TWEET_OAUTH_CONSUMER_KEY')
+-TWEET_OAUTH_CONSUMER_SECRET = config.get('twitter', 'TWEET_OAUTH_CONSUMER_SECRET')
+-TWEET_OAUTH_ACCESS_TOKEN = config.get('twitter', 'TWEET_OAUTH_ACCESS_TOKEN')
+-TWEET_OAUTH_ACCESS_TOKEN_SECRET = config.get('twitter', 'TWEET_OAUTH_ACCESS_TOKEN_SECRET')
+-
+-TWEET_MAPQUEST_API_KEY = config.get('geo', 'TWEET_MAPQUEST_API_KEY')
++STATIC_URL = '/tweet-django/static/'
+
+ # Logging
+
- + 'filename': '/var/log/tweet-django/debug.log',
++ LOGGING = {
++ 'version': 1,
++ 'disable_existing_loggers': False,
+++ 'formatters': {
+++ 'verbose': {
+++ 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
+++ },
+++ 'simple': {
+++ 'format': '%(levelname)s %(message)s'
+++ },
+++ },
++ 'handlers': {
++ 'console': {
++ 'class': 'logging.StreamHandler',
++@@ -151,19 +128,36 @@
+ 'file': {
+ 'level': 'DEBUG',
+ 'class': 'logging.FileHandler',
+- 'filename': 'django_debug.log',
- + 'handlers': ['file'],
- 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
+++ 'filename': '/var/log/tweet-django/tweet-django.log',
+++ 'formatter': 'verbose'
+ },
+++ 'mail_admins': {
+++ 'level': 'ERROR',
+++ 'class': 'django.utils.log.AdminEmailHandler',
+++ }
+ },
+ 'loggers': {
+ 'django': {
+- 'handlers': ['console'],
- + 'handlers': ['file'],
- 'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
++- 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
+++ 'handlers': ['file', 'mail_admins'],
+++ 'level': os.getenv('DJANGO_LOG_LEVEL', 'WARNING'),
+ 'propagate': True
+ },
+ 'tweet': {
+- 'handlers': ['console'],
++- 'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
+++ 'handlers': ['file', 'mail_admins'],
+++ 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
+ 'propagate': True
+ },
+ },
+ }
++
++# Default paths
++TWEET_BASEPATH = '/var/lib/tweet-django'
++STATIC_ROOT = '/usr/share/tweet-django/static'
++STATIC_URL = '/tweet-django/static/'
++
++# Database settings, provided by dbconfig_common
++if os.path.exists("/etc/tweet-django/dbsettings.py"):
++ exec(open("/etc/tweet-django/dbsettings.py").read())
++
++if os.path.exists("/etc/tweet-django/settings.py"):
++ exec(open("/etc/tweet-django/settings.py").read())
--- /dev/null
- #install -m 0755 -D manage.py --target-directory=$(DESTDIR)/usr/share/tweet-django/
- #install -m 0755 -D runstream.py --target-directory=$(DESTDIR)/usr/share/tweet-django/
- #install -m 0640 -D tweet/*.py --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet/
- #install -m 0640 -D tweet/migrations/*.py --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet/migrations
- #install -m 0640 -D tweet/templates/tweet/* --target-directory=$(DESTDIR)/usr/share/tweet-django/templates/tweet/
- #install -m 0640 -D tweet/static/tweet/favicon.ico --target-directory=$(DESTDIR)/usr/share/tweet-django/static/tweet/
- #install -m 0640 -D tweet/static/tweet/stylesheets/main.css --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet_django/static/tweet/stylesheets/main.css
- #install -m 0640 -D tweet_django/*.py --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet_django/
- #install -m 0640 -D debian/dbsettings.py.template --target-directory=$(DESTDIR)/usr/share/tweet-django/debian/
- #install -m 0640 -D debian/settings.py.template --target-directory=$(DESTDIR)/usr/share/tweet-django/debian/
- #install -m 0640 -D debian/apache.conf --target-directory=$(DESTDIR)/etc/tweet-django/
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+DESTDIR := debian/tweet-django
+
+%:
+ dh $@ --with python3,systemd,apache2
+
+override_dh_auto_install:
++ # Do nothing fancy, just dh_install and friends which will happen automatically anyway
+