path fix
This commit is contained in:
parent
853b0e0a7d
commit
c35bc143e3
@ -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 /;
|
||||
|
@ -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> n’a pas été trouvé.'.format(path), start_response)
|
||||
|
||||
|
||||
return htmlresp(404, 'Le fichier ou dossier <em>{}</em> n’a 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 {} n’a pas été trouvé. {}'.format(module_path, str(path_elements)))
|
||||
print('Le fichier {} n’a pas été trouvé. {}'.format(module_path, str(path_elements)))
|
||||
return htmlresp(404, 'Le fichier <em>{}</em> n’a pas été trouvé.'.format(path), start_response)
|
||||
|
||||
# Find which parameters the function needs
|
||||
|
Loading…
Reference in New Issue
Block a user