path fix
This commit is contained in:
parent
853b0e0a7d
commit
c35bc143e3
@ -30,17 +30,17 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
|
|
||||||
root /usr/share/app/python_app/modules/;
|
root /app/python_app/modules/;
|
||||||
location ~ favicon.ico {
|
location ~ favicon.ico {
|
||||||
root /usr/share/app/;
|
root /usr/share/app/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# index index.html main.py;
|
index index.html main.py;
|
||||||
# try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
# }
|
}
|
||||||
|
|
||||||
#location ~ \.py {
|
location ~ \.py {
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
#uwsgi_param PATH_INFO "$1";
|
#uwsgi_param PATH_INFO "$1";
|
||||||
#uwsgi_param SCRIPT_NAME /;
|
#uwsgi_param SCRIPT_NAME /;
|
||||||
|
@ -29,14 +29,13 @@ def application(env, start_response):
|
|||||||
path = path_minus_one
|
path = path_minus_one
|
||||||
function = path_elements[-1]
|
function = path_elements[-1]
|
||||||
elif os.path.isfile(BASE_MODULE_PATH + path):
|
elif os.path.isfile(BASE_MODULE_PATH + path):
|
||||||
|
path = path_minus_one + '/main'
|
||||||
function = 'index'
|
function = 'index'
|
||||||
elif os.path.isdir(BASE_MODULE_PATH + path):
|
elif os.path.isdir(BASE_MODULE_PATH + path):
|
||||||
path += '/main'
|
path += '/main'
|
||||||
function = 'index'
|
function = 'index'
|
||||||
else:
|
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 full path
|
||||||
module_path = BASE_MODULE_PATH + path
|
module_path = BASE_MODULE_PATH + path
|
||||||
@ -47,7 +46,7 @@ def application(env, start_response):
|
|||||||
m = importlib.import_module(module_path)
|
m = importlib.import_module(module_path)
|
||||||
importlib.reload(m)
|
importlib.reload(m)
|
||||||
except ModuleNotFoundError:
|
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)
|
return htmlresp(404, 'Le fichier <em>{}</em> n’a pas été trouvé.'.format(path), start_response)
|
||||||
|
|
||||||
# Find which parameters the function needs
|
# Find which parameters the function needs
|
||||||
|
Loading…
Reference in New Issue
Block a user