import from od2m app

main
jgenero 3 years ago
parent fc3c59014e
commit 3a550e8912

@ -0,0 +1,4 @@
#!/bin/bash
source .venv/bin/activate
export FLASK_ENV=development
export FLASK_APP=index.py

@ -0,0 +1,45 @@
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName ouvriersdeuxmondes.huma-num.fr
ServerAdmin jean-damien.genero@ehess.fr
# Document root doesn't really matter as it will be overriden
DocumentRoot /var/www/html
# WSGI configuration
# - name the process od2m
# - run it as dedicated www-od2m user
WSGIDaemonProcess od2m user=www-od2m group=www-od2m threads=5 python-home=/var/www/od2m/.venv/ locale=en_US.UTF-8 socket-timeout=600
WSGIScriptAlias / /var/www/od2m/wsgi.py
<Directory /var/www/od2m>
WSGIProcessGroup od2m
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
# Log files configuration
ErrorLog ${APACHE_LOG_DIR}/od2m-error.log
CustomLog ${APACHE_LOG_DIR}/od2m-access.log combined
# SSL configuration
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/ouvriersdeuxmondes.huma-num.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ouvriersdeuxmondes.huma-num.fr/privkey.pem
</VirtualHost>
<VirtualHost *:80>
# Make the HTTP virtual host redirect to HTTPS
ServerName ouvriersdeuxmondes.huma-num.fr
Redirect / https://ouvriersdeuxmondes.huma-num.fr
</VirtualHost>
</IfModule>

@ -0,0 +1,2 @@
LoadModule wsgi_module "/var/www/od2m/.venv/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so"
WSGIPythonHome "/var/www/od2m/.venv"

@ -0,0 +1,3 @@
#!/bin/bash
export DEBUGGER=True
"$@"

@ -0,0 +1,14 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
author = Jean-Damien Généro
date = 2020-12-15
"""
from app import app
if __name__ == "__main__":
app.run(debug=True)

@ -0,0 +1,4 @@
[mypy]
ignore_missing_imports=True
follow_imports=silent
show_column_numbers=True

@ -0,0 +1,17 @@
[flake8]
# E501: line too long -> managed by black, allow some lines (docstring, etc.) to be longer
# W503: Line break occurred before a binary operator -> preferred way for black
# E203: Whitespace before ':' -> managed by black, allow some cases (subscripting, etc.)
ignore = E501, W503, E203
max-line-length = 110
[isort]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 110
[pytest]
norecursedirs = .venv .eggs

@ -0,0 +1,18 @@
import os
import sys
import typing as t
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
activate_this = os.path.abspath(os.path.dirname(__file__)) + "/.venv/bin/activate_this.py"
if os.path.exists(activate_this):
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
# On importe l'app uniquement APRES avoir activé le virtualenv
from app import app
app.config["FLASK_ENV"] = "production"
def application(req_environ: dict, start_response: t.Callable) -> t.Any:
return app(req_environ, start_response)
Loading…
Cancel
Save