This commit is contained in:
Adrian Amaglio 2021-03-10 21:40:45 +01:00
parent 853b0e0a7d
commit c35bc143e3
2 changed files with 8 additions and 9 deletions

View File

@ -30,17 +30,17 @@ server {
listen 80;
listen [::]:80;
root /usr/share/app/python_app/modules/;
root /app/python_app/modules/;
location ~ favicon.ico {
root /usr/share/app/;
}
location / {
# index index.html main.py;
# try_files $uri $uri/ =404;
# }
index index.html main.py;
try_files $uri $uri/ =404;
}
#location ~ \.py {
location ~ \.py {
include uwsgi_params;
#uwsgi_param PATH_INFO "$1";
#uwsgi_param SCRIPT_NAME /;

View File

@ -29,14 +29,13 @@ def application(env, start_response):
path = path_minus_one
function = path_elements[-1]
elif os.path.isfile(BASE_MODULE_PATH + path):
path = path_minus_one + '/main'
function = 'index'
elif os.path.isdir(BASE_MODULE_PATH + path):
path += '/main'
function = 'index'
else:
return htmlresp(404, 'Le dossier <em>{}</em> na pas été trouvé.'.format(path), start_response)
return htmlresp(404, 'Le fichier ou dossier <em>{}</em> na pas été trouvé.'.format(path), start_response)
# Module full path
module_path = BASE_MODULE_PATH + path
@ -47,7 +46,7 @@ def application(env, start_response):
m = importlib.import_module(module_path)
importlib.reload(m)
except ModuleNotFoundError:
#print('Le fichier {} na pas été trouvé. {}'.format(module_path, str(path_elements)))
print('Le fichier {} na pas été trouvé. {}'.format(module_path, str(path_elements)))
return htmlresp(404, 'Le fichier <em>{}</em> na pas été trouvé.'.format(path), start_response)
# Find which parameters the function needs