From: Jan-Pascal van Best Date: Thu, 18 Feb 2016 20:54:13 +0000 (+0100) Subject: Merged upstream release v1.1 X-Git-Tag: debian/1.2-1~3 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=2f8ea3174bad4ec7efe9d24370f1bbd9e3749cda;p=tweet-django-debian Merged upstream release v1.1 --- 2f8ea3174bad4ec7efe9d24370f1bbd9e3749cda diff --cc debian/README index a502132,0000000..51cfc4a mode 100644,000000..100644 --- a/debian/README +++ b/debian/README @@@ -1,9 -1,0 +1,18 @@@ +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 diff --cc debian/TODO index 6164b69,0000000..9f7d3bf mode 100644,000000..100644 --- a/debian/TODO +++ b/debian/TODO @@@ -1,7 -1,0 +1,6 @@@ - - Have the run_stream daemon log somewhere useful - - Remove the logging of the wsgi app from the apache2 error log to somewhere else - - do not start runstream daemon if not configured +- display warning in web app if not configured - - provide Debian README on how to configure - - if possible, use tweet-django.install to clean up debian/rules a bit +- test install/upgrade/remove/reinstall/purge etc. ++- logrotate ++- timestamp in logs ++- log file name ++ diff --cc debian/changelog index c14a860,0000000..66605f7 mode 100644,000000..100644 --- a/debian/changelog +++ b/debian/changelog @@@ -1,5 -1,0 +1,11 @@@ ++tweet-django (1.1-1) unstable; urgency=medium ++ ++ * New upstream release ++ ++ -- Jan-Pascal van Best Thu, 18 Feb 2016 21:55:11 +0100 ++ +tweet-django (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Jan-Pascal van Best Thu, 11 Feb 2016 21:39:09 +0100 diff --cc debian/patches/patch-settings index 034d6db,0000000..3fac843 mode 100644,000000..100644 --- a/debian/patches/patch-settings +++ b/debian/patches/patch-settings @@@ -1,103 -1,0 +1,124 @@@ +Description: Patch settings to fit in Debian system +Author: Jan-Pascal van Best +--- +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': [ - @@ -109,35 +106,7 @@ ++@@ -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 + - @@ -151,19 +120,31 @@ ++ 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', - + 'filename': '/var/log/tweet-django/debug.log', +++ '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', 'INFO'), ++- 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'), +++ 'handlers': ['file', 'mail_admins'], +++ 'level': os.getenv('DJANGO_LOG_LEVEL', 'WARNING'), + 'propagate': True + }, + 'tweet': { +- 'handlers': ['console'], - + 'handlers': ['file'], - 'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'), ++- '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()) diff --cc debian/rules index 6965c98,0000000..cecbe7d mode 100755,000000..100755 --- a/debian/rules +++ b/debian/rules @@@ -1,21 -1,0 +1,11 @@@ +#!/usr/bin/make -f +# -*- makefile -*- + +DESTDIR := debian/tweet-django + +%: + dh $@ --with python3,systemd,apache2 + +override_dh_auto_install: - #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/ ++ # Do nothing fancy, just dh_install and friends which will happen automatically anyway + diff --cc debian/tweet-django.logrotate index 0000000,0000000..8a603a5 new file mode 100644 --- /dev/null +++ b/debian/tweet-django.logrotate @@@ -1,0 -1,0 +1,9 @@@ ++/var/log/tweet-django/*.log { ++ rotate 14 ++ daily ++ compress ++ delaycompress ++ copytruncate ++ missingok ++ notifempty ++}