From 3556c80167b21e36476dd0a56ded6e8c4fc0020c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 8 Aug 2019 10:43:01 +0200 Subject: Install templates --- .gitignore | 1 + Makefile | 4 ++++ collected_static/DO_NOT_PUT_FILE_HERE | 0 commonnet/settings.py | 18 +----------------- conf/nginx.conf.template | 35 +++++++++++++++++++++++++++++++++++ conf/uwsgi.ini.template | 17 +++++++++++++++++ media/DO_NOT_PUT_FILE_HERE | 0 7 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 collected_static/DO_NOT_PUT_FILE_HERE create mode 100644 conf/nginx.conf.template create mode 100644 conf/uwsgi.ini.template create mode 100644 media/DO_NOT_PUT_FILE_HERE diff --git a/.gitignore b/.gitignore index 2f96206..a007f2c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ local_settings.py result.json data_src +collected_static/* diff --git a/Makefile b/Makefile index 9ce49e9..9c3eb66 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,10 @@ migrations: ## make DB migrations migrate: ## apply DB migrations $(PYTHON) manage.py migrate +collectstatic: ## web - collect static files to serve + $(PYTHON) manage.py collectstatic --no-input + + regenerate_all: migrate ## regenerate all the database $(PYTHON) manage.py createsuperuser $(PYTHON) manage.py import_csv_communes data_src/communes.csv diff --git a/collected_static/DO_NOT_PUT_FILE_HERE b/collected_static/DO_NOT_PUT_FILE_HERE new file mode 100644 index 0000000..e69de29 diff --git a/commonnet/settings.py b/commonnet/settings.py index d2048b2..d50aff9 100644 --- a/commonnet/settings.py +++ b/commonnet/settings.py @@ -79,11 +79,6 @@ DATABASES = { } } - - -# Password validation -# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators - AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', @@ -99,27 +94,16 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] - -# Internationalization -# https://docs.djangoproject.com/en/1.11/topics/i18n/ - LANGUAGE_CODE = 'fr-fr' - TIME_ZONE = 'Europe/Paris' - USE_I18N = True - USE_L10N = True - USE_TZ = True - DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000 -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.11/howto/static-files/ - STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR, "collected_static") CRAWL_TIMEOUT = 30 # timeout for each website crawl in minutes diff --git a/conf/nginx.conf.template b/conf/nginx.conf.template new file mode 100644 index 0000000..703699f --- /dev/null +++ b/conf/nginx.conf.template @@ -0,0 +1,35 @@ +server { + listen 80; + server_name #URL#; + root /srv/commonnet/; # install path + access_log /var/log/django/commonnet-access.log; + error_log /var/log/django/commonnet-error.log; + + gzip on; + gzip_disable "msie6"; + gzip_comp_level 6; + gzip_min_length 1100; + gzip_buffers 16 8k; + gzip_proxied any; + gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/rss+xml image/svg+xml; + + client_max_body_size 200M; + + location /static/ { # STATIC_URL + alias /srv/commonnet/collected_static/; # STATIC_ROOT + expires 30d; + } + + location /media/ { # MEDIA_URL + alias /srv/commonnet/media/; # MEDIA_ROOT + expires 30d; + } + + location / { + include uwsgi_params; + uwsgi_pass unix:/var/lib/uwsgi/run/commonnet.sock; + uwsgi_read_timeout 1800; + uwsgi_send_timeout 600; + } +} + diff --git a/conf/uwsgi.ini.template b/conf/uwsgi.ini.template new file mode 100644 index 0000000..089c952 --- /dev/null +++ b/conf/uwsgi.ini.template @@ -0,0 +1,17 @@ +[uwsgi] +# variables +projectname = commonnet +projectdomain = #URL# # ex: commonnet.myorganization.net +base = /srv/commonnet/ # install path + +# config +plugins = python +master = true +protocol = uwsgi +env = DJANGO_SETTINGS_MODULE=%(projectname).settings +pythonpath = %(base) +module = %(projectname).wsgi +socket = /var/lib/uwsgi/run/%(projectname).sock +logto = /var/log/django/uwsgi-%(projectname).log +daemonize = /var/log/uwsgi/uwsgi-%(projectname).log +buffer-size=65535 diff --git a/media/DO_NOT_PUT_FILE_HERE b/media/DO_NOT_PUT_FILE_HERE new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3