Hi there.
My application has some scripts on .app.scripts (.app.scripts.tests and .app.scripts.config).
I configured this scripts in setup.py file like this:
entry_points={
'paste.app_factory': [
'main = minisecbgp:main'
],
'console_scripts': [
'initialize_minisecbgp_db = minisecbgp.scripts.initialize_db:main',
'tests = minisecbgp.scripts.tests:main',
'validate_hostname = minisecbgp.scripts.validate_hostname:main',
'config = minisecbgp.scripts.config:main',
],
I call these two scripts in my view with the code below:
arguments = ['--config_file=minisecbgp.ini',
'--hostname=%s' % form.node.data,
'--username=%s' % form.username.data,
'--password=%s' % form.password.data]
subprocess.Popen(['config'] + arguments)
and, when I run my application with the commands below, everything works well. The page works fine and the scripts tests and config works well.
pip install -e ".[testing]"
pserve minisecbgp.ini --reload
So, I want to put my app in production, and I'm trying to use uwsgi and nginx to do it. When I configured uwsgi and nginx and open the app in browser, the app works well, but when I call the view that executes the scripts tests and config, I receave a 502 bad gateway error. Looking at syslog file, I receaved this error:
Feb 27 20:12:56 lpttch uwsgi[14110]: subprocess.Popen(['tests'] + arguments)
Feb 27 20:12:56 lpttch uwsgi[14110]: File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
Feb 27 20:12:56 lpttch uwsgi[14110]: restore_signals, start_new_session)
Feb 27 20:12:56 lpttch uwsgi[14110]: File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
Feb 27 20:12:56 lpttch uwsgi[14110]: raise child_exception_type(errno_num, err_msg, err_filename)
Feb 27 20:12:56 lpttch uwsgi[14110]: FileNotFoundError: [Errno 2] No such file or directory: 'tests': 'tests'
Please, can somebody help me?
Emerson