Closed KSuondProject closed 3 years ago
It should be the ip of your pi, did you followed the tutorial for the webserver in the wiki?
Yes, I've followed the wiki instruction. In every form that required the "your address" I've putted the IP of my raspberry. But when I open the browser page I see only the nginx startup page and not the webserver. In this moment after a reboot I see a 502 bad gatway error. There's some command that I can try to see what I miss? The systemctl status command says me that the serice is active with no error.
pi@raspberrypi:~ $ sudo systemctl status myproject
● myproject.service - Gunicorn instance to serve myproject
Loaded: loaded (/etc/systemd/system/myproject.service; enabled; vendor preset
Active: active (running) since Sat 2020-12-26 22:16:57 GMT; 55min ago
Main PID: 472 (gunicorn)
Tasks: 4 (limit: 881)
CGroup: /system.slice/myproject.service
├─472 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e
├─496 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e
├─497 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e
└─498 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e
Dec 26 22:16:57 raspberrypi systemd[1]: Started Gunicorn instance to serve mypro
Dec 26 22:17:04 raspberrypi gunicorn[472]: [2020-12-26 22:17:04 +0000] [472] [IN
Dec 26 22:17:04 raspberrypi gunicorn[472]: [2020-12-26 22:17:04 +0000] [472] [IN
Dec 26 22:17:04 raspberrypi gunicorn[472]: [2020-12-26 22:17:04 +0000] [472] [IN
Dec 26 22:17:04 raspberrypi gunicorn[472]: [2020-12-26 22:17:04 +0000] [496] [IN
Dec 26 22:17:04 raspberrypi gunicorn[472]: [2020-12-26 22:17:04 +0000] [497] [IN
Dec 26 22:17:04 raspberrypi gunicorn[472]: [2020-12-26 22:17:04 +0000] [498] [IN
lines 1-18/18 (END)
I really don't know what I've missed. Thanks for the support.
Mmm, gunicorn seems to be working fine, try again the step 5 from the tutorial please
Mmm, gunicorn seems to be working fine, try again the step 5 from the tutorial please
Just do that but nothing, is always showing this page when I call the Raspberry's IP in the browser:
This is my nginx file:
server {
listen 80;
server_name localhost www.192.168.1.126;
location / {
include proxy_params;
proxy_pass http://unix:/home/pi/e_paper_dashboard/www/Dashweb.sock;
}
}
Another noob question, the "Dashweb.sock" is a file? I haven't found it in that folder.
Also the settings.html located in the /home/pi/e_paper_dashboard/www/templates folder have 192.168.1.126 IP
yeah its a file in the www folder, it creates when you start and enable the service,
in your nginx file remove the "www." and restart nginx
I've removed the "www." but now the page response a "502" Bad gateway. Any ideas? Why I don't have the "Dashweb.sock" file?
Thank you again for the support.
pi@raspberrypi:~/e_paper_dashboard $ tail -f /var/log/nginx/error.log
2020/12/26 22:24:27 [crit] 597#597: *1 connect() to unix:/home/pi/e_paper_dashboard/www/Dashweb.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.1.100, server: 192.168.1.126, request: "GET / HTTP/1.1", upstream: "http://unix:/home/pi/e_paper_dashboard/www/Dashweb.sock:/", host: "192.168.1.126"
Why have a permission denied? There's wrong with my router? Some firewall problem?
mmmm, what about the ufw did you ran the commands to allow nginx?
sudo ufw delete allow 5000
sudo ufw allow 'Nginx Full'
can you also show me what you have in your service file? (code)
Here's all the result:
pi@raspberrypi:~/e_paper_dashboard $ sudo ufw delete allow 5000
Could not delete non-existent rule
Could not delete non-existent rule (v6)
pi@raspberrypi:~/e_paper_dashboard $ sudo ufw allow 'Nginx Full'
Skipping adding existing rule
Skipping adding existing rule (v6)
pi@raspberrypi:~/e_paper_dashboard $
[Unit]
Description=Gunicorn instance to serve myproject
After=network.target
[Service]
User=pi
Group=www-data
WorkingDirectory=/home/pi/e_paper_dashboard/www
Environment="PATH=/home/pi/e_paper_dashboard/www/dashenv/bin"
ExecStart=/home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
when you run sudo systemctl status myproject can you give me the rest of what it says on the right side, the message above came cut, extend your console a bit to the right
● myproject.service - Gunicorn instance to serve myproject
Loaded: loaded (/etc/systemd/system/myproject.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-12-27 10:40:31 GMT; 56min ago
Main PID: 477 (gunicorn)
Tasks: 4 (limit: 881)
CGroup: /system.slice/myproject.service
├─477 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
├─488 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
├─489 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
└─490 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
Dec 27 10:40:31 raspberrypi systemd[1]: Started Gunicorn instance to serve myproject.
Dec 27 10:40:40 raspberrypi gunicorn[477]: [2020-12-27 10:40:40 +0000] [477] [INFO] Starting gunicorn 20.0.4
Dec 27 10:40:40 raspberrypi gunicorn[477]: [2020-12-27 10:40:40 +0000] [477] [INFO] Listening at: unix:Dashweb.sock (477)
Dec 27 10:40:40 raspberrypi gunicorn[477]: [2020-12-27 10:40:40 +0000] [477] [INFO] Using worker: sync
Dec 27 10:40:40 raspberrypi gunicorn[477]: [2020-12-27 10:40:40 +0000] [488] [INFO] Booting worker with pid: 488
Dec 27 10:40:40 raspberrypi gunicorn[477]: [2020-12-27 10:40:40 +0000] [489] [INFO] Booting worker with pid: 489
Dec 27 10:40:41 raspberrypi gunicorn[477]: [2020-12-27 10:40:41 +0000] [490] [INFO] Booting worker with pid: 490
mmmm, the sock file is there, how are you seeing you files?, via winscp?, ls?
try opening the port 80 as well sudo ufw allow 80
and reload the web browser if nothing comes up restart nginx again after this add
I've opened a ftp connection with linux mint file explorer and I don't see that file.
I've opened the 80 standard http port and restart the gninx service as you say me but nothing happen:
2020/12/27 11:43:16 [crit] 1041#1041: *1 connect() to unix:/home/pi/e_paper_dashboard/www/Dashweb.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.1.26, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/home/pi/e_paper_dashboard/www/Dashweb.sock:/", host: "192.168.1.126"
try renaming your service file to Dashweb.service instead of myproject.service and reload it.
sorry if it seems like shooting in the dark, havent gotten errors like these ones, so trying what I think it might be
Is it correct?
pi@raspberrypi:~/e_paper_dashboard/www $ sudo systemctl disable myproject
Removed /etc/systemd/system/multi-user.target.wants/myproject.service.
pi@raspberrypi:~/e_paper_dashboard/www $ sudo systemctl start Dashweb
pi@raspberrypi:~/e_paper_dashboard/www $ sudo systemctl enable Dashweb
Created symlink /etc/systemd/system/multi-user.target.wants/Dashweb.service → /etc/systemd/system/Dashweb.service.
pi@raspberrypi:~/e_paper_dashboard/www $ sudo systemctl status Dashweb
● Dashweb.service - Gunicorn instance to serve myproject
Loaded: loaded (/etc/systemd/system/Dashweb.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-12-27 12:14:18 GMT; 1min 15s ago
Main PID: 1277 (gunicorn)
Tasks: 4 (limit: 881)
CGroup: /system.slice/Dashweb.service
├─1277 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
├─1279 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
├─1280 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
└─1281 /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7 /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
Dec 27 12:14:18 raspberrypi systemd[1]: Started Gunicorn instance to serve myproject.
Dec 27 12:14:22 raspberrypi gunicorn[1277]: [2020-12-27 12:14:22 +0000] [1277] [INFO] Starting gunicorn 20.0.4
Dec 27 12:14:22 raspberrypi gunicorn[1277]: [2020-12-27 12:14:22 +0000] [1277] [INFO] Listening at: unix:Dashweb.sock (1277)
Dec 27 12:14:22 raspberrypi gunicorn[1277]: [2020-12-27 12:14:22 +0000] [1277] [INFO] Using worker: sync
Dec 27 12:14:22 raspberrypi gunicorn[1277]: [2020-12-27 12:14:22 +0000] [1279] [INFO] Booting worker with pid: 1279
Dec 27 12:14:22 raspberrypi gunicorn[1277]: [2020-12-27 12:14:22 +0000] [1280] [INFO] Booting worker with pid: 1280
Dec 27 12:14:22 raspberrypi gunicorn[1277]: [2020-12-27 12:14:22 +0000] [1281] [INFO] Booting worker with pid: 1281
pi@raspberrypi:~/e_paper_dashboard/www $
I've restarted the gninx service, but always Bad Gateway.
I was looking around and from the error it seems that its permissions (as it says), the file does exist, try refreshing your ftp connection,(it does happens to me when using winscp and they I refresh the explorer and it shows), on the terminal in the www folder do sudo chmod 0777 Dashweb.sock
pi@raspberrypi:~/e_paper_dashboard/www $ sudo chmod 0777 Dashweb.sock
chmod: cannot access 'Dashweb.sock': No such file or directory
I really don't know how is possible. I can copy this file from somewhere?
Sorry I have accidentally close the issue by pressing "close" form from app.
in the service file try this
remove the -m from
ExecStart=/home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app
save and restart the service sudo systemctl daemon-reload sudo systemctl restart Dashweb
I've do all of that you write up, nothing change. No .sock file created and always 502 Bad Gateway. Maybe something wrong with the pip modules?
I'm starting from a fresh distro. I've some pip modules in the requirements.txt that I can't instal:
----------------------------------------
Failed building wheel for gpg
Running setup.py clean for gpg
Running setup.py bdist_wheel for pycairo ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk8gu0/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-mA4ZNy --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv6l-2.7
creating build/lib.linux-armv6l-2.7/cairo
copying cairo/__init__.py -> build/lib.linux-armv6l-2.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-armv6l-2.7/cairo
copying cairo/py.typed -> build/lib.linux-armv6l-2.7/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
----------------------------------------
Failed building wheel for pycairo
Running setup.py clean for pycairo
Failed to build gpg pycairo
Installing collected packages: gpg, gunicorn, pycairo
Running setup.py install for gpg ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk8gu0/gpg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mbEUEt/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_ext
building 'gpg._gpgme' extension
swigging build/gpgme.i to build/gpgme_wrap.c
swig -python -threads -Ibuild -outdir build/lib.linux-armv6l-2.7/gpg -o build/gpgme_wrap.c build/gpgme.i
unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk8gu0/gpg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mbEUEt/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-sk8gu0/gpg/
I've search in google but I haven't found a right solution. Why from fresh install I've these problem? Are these modules essential for the project? The requirements.txt is better with "pip" or "pip3"?
I'm starting from a fresh distro. I've some pip modules in the requirements.txt that I can't instal:
---------------------------------------- Failed building wheel for gpg Running setup.py clean for gpg Running setup.py bdist_wheel for pycairo ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk8gu0/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-mA4ZNy --python-tag cp27: running bdist_wheel running build running build_py creating build creating build/lib.linux-armv6l-2.7 creating build/lib.linux-armv6l-2.7/cairo copying cairo/__init__.py -> build/lib.linux-armv6l-2.7/cairo copying cairo/__init__.pyi -> build/lib.linux-armv6l-2.7/cairo copying cairo/py.typed -> build/lib.linux-armv6l-2.7/cairo running build_ext Package cairo was not found in the pkg-config search path. Perhaps you should add the directory containing `cairo.pc' to the PKG_CONFIG_PATH environment variable No package 'cairo' found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1 ---------------------------------------- Failed building wheel for pycairo Running setup.py clean for pycairo Failed to build gpg pycairo Installing collected packages: gpg, gunicorn, pycairo Running setup.py install for gpg ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk8gu0/gpg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mbEUEt/install-record.txt --single-version-externally-managed --compile --user --prefix=: running install running build running build_ext building 'gpg._gpgme' extension swigging build/gpgme.i to build/gpgme_wrap.c swig -python -threads -Ibuild -outdir build/lib.linux-armv6l-2.7/gpg -o build/gpgme_wrap.c build/gpgme.i unable to execute 'swig': No such file or directory error: command 'swig' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sk8gu0/gpg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mbEUEt/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-sk8gu0/gpg/
I've search in google but I haven't found a right solution. Why from fresh install I've these problem? Are these modules essential for the project? The requirements.txt is better with "pip" or "pip3"?
I've resolved with:
sudo apt install libgirepository1.0-dev
sudo apt install libcairo2-dev
sudo apt-get install build-essential libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
sudo apt install python3-gpg
I've finished the setup and I'm here again with the 502 Bad Gateway :cry: I really don't know what I can do to make it works.
Hey, sorry, it was a little late for me yesterday and even right now,,,(I'm on central time, though in vacation which is why I'm still up, heh,) so what is tail -f /var/log/nginx/error.log
throwing you this time?
someone else use to have some problem of permissions, what we tried with him was this -remove the project from the pi -create your own empty folders for the e_paper_dashboard and an empty folder for www inside of it -move the contents of the www folder from the project to the new empty folder, do the same with the other folders and files inside the e_paper_dashboard folder level
Hey, sorry, it was a little late for me yesterday and even right now,,,(I'm on central time, though in vacation which is why I'm still up, heh,) so what is tail -f /var/log/nginx/error.log
throwing you this time?
absolutely no problem, indeed thank you so much for your help! Here's the log, the same of yesterday:
2020/12/28 10:52:39 [crit] 2541#2541: *3 connect() to unix:/home/pi/e_paper_dashboard/www/Dashweb.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.1.26, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/pi/e_paper_dashboard/www/Dashweb.sock:/favicon.ico", host: "192.168.1.126", referrer: "http://192.168.1.126/"
someone else use to have some problem of permissions, what we tried with him was this -remove the project from the pi -create your own empty folders for the e_paper_dashboard and an empty folder for www inside of it -move the contents of the www folder from the project to the new empty folder, do the same with the other folders and files inside the e_paper_dashboard folder level
Ok, I try it right now! Let you know asap.
But the dashboard.sock will created automatically when the webserver works? Because I don't have this file.
Once you move the files you'll have to reload the service after that check if the sock file it's created in the folder
Ok, the copy of files is near to the end. I'll write soon!
pi@raspberrypi:~ $ sudo systemctl status dashweb
● dashweb.service - Gunicorn instance to serve myproject
Loaded: loaded (/etc/systemd/system/dashweb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-12-28 11:28:33 GMT; 1s ago
Process: 582 ExecStart=/home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:Dashweb.sock -m 007 wsgi:app (code=exited, status=203/EXEC)
Main PID: 582 (code=exited, status=203/EXEC)
Dec 28 11:28:33 raspberrypi systemd[1]: Started Gunicorn instance to serve myproject.
Dec 28 11:28:33 raspberrypi systemd[582]: dashweb.service: Failed to execute command: No such file or directory
Dec 28 11:28:33 raspberrypi systemd[582]: dashweb.service: Failed at step EXEC spawning /home/pi/e_paper_dashboard/www/dashenv/bin/gunicorn: No such file or directory
Dec 28 11:28:33 raspberrypi systemd[1]: dashweb.service: Main process exited, code=exited, status=203/EXEC
Dec 28 11:28:33 raspberrypi systemd[1]: dashweb.service: Failed with result 'exit-code'.
The file is in that folder, whats wrong?
oh, it finally appeared, did you do tried to reinstall your virtual environment files after moving the files in the new folder?
pi@raspberrypi:~/dashboard/www $ python3.7 -m venv dashenv
pi@raspberrypi:~/dashboard/www $ source dashenv/bin/activate
(dashenv) pi@raspberrypi:~/dashboard/www $ pip list
-bash: /home/pi/dashboard/www/dashenv/bin/pip: /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7: bad interpreter: No such file or directory
:cry:
(dashenv) pi@raspberrypi:~/dashboard/www $ sudo systemctl status dashweb
● dashweb.service - Gunicorn instance to serve myproject
Loaded: loaded (/etc/systemd/system/dashweb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-12-28 12:17:23 GMT; 6s ago
Process: 801 ExecStart=/home/pi/dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:dashweb.sock 007 wsgi:app
Main PID: 801 (code=exited, status=203/EXEC)
Dec 28 12:17:23 raspberrypi systemd[1]: Started Gunicorn instance to serve myproject.
Dec 28 12:17:23 raspberrypi systemd[801]: dashweb.service: Failed to execute command: No such file or directory
Dec 28 12:17:23 raspberrypi systemd[801]: dashweb.service: Failed at step EXEC spawning /home/pi/dashboard/www/dashenv
Dec 28 12:17:23 raspberrypi systemd[1]: dashweb.service: Main process exited, code=exited, status=203/EXEC
Dec 28 12:17:23 raspberrypi systemd[1]: dashweb.service: Failed with result 'exit-code'.
the service file with the correct directorys:
[Unit]
Description=Gunicorn instance to serve myproject
After=network.target
[Service]
User=pi
Group=www-data
WorkingDirectory=/home/pi/dashboard/www
Environment="PATH=/home/pi/dashboard/www/dashenv/bin"
ExecStart=/home/pi/dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:dashweb.sock 007 wsgi:app
[Install]
WantedBy=multi-user.target
while you are in your virtual environment in the www folder try
gunicorn --bind 0.0.0.0:5000 wsgi:app
pi@raspberrypi:~/dashboard/www $ source dashenv/bin/activate
(dashenv) pi@raspberrypi:~/dashboard/www $ gunicorn --bind 0.0.0.0:5000 wsgi:app
-bash: /home/pi/dashboard/www/dashenv/bin/gunicorn: /home/pi/e_paper_dashboard/www/dashenv/bin/python3.7: bad interpreter: No such file or directory
(dashenv) pi@raspberrypi:~/dashboard/www $
reinstall the packages while in the venv
pip install gunicorn flask wheel
now after the gunicorn command the result is:
(dashenv) pi@raspberrypi:~/dashboard/www $ gunicorn --bind 0.0.0.0:5000 wsgi:app
[2020-12-28 12:59:40 +0000] [969] [INFO] Starting gunicorn 19.10.0
[2020-12-28 12:59:40 +0000] [969] [INFO] Listening at: http://0.0.0.0:5000 (969)
[2020-12-28 12:59:40 +0000] [969] [INFO] Using worker: sync
[2020-12-28 12:59:40 +0000] [972] [INFO] Booting worker with pid: 972
[2020-12-28 12:59:44,984] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/pi/dashboard/www/Webserver.py", line 106, in login
d_data = getinfo()
File "/home/pi/dashboard/www/Webserver.py", line 45, in getinfo
with open(tempdir, "r") as f1, open(creddir, "w+") as f2:
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/dashboard/credentials/dash_id.json'
the browser:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
is there a "credentials" folder in your dashboard folder?, if not, can you create and run gunicorn again
OMG!!! Finally I see the webserver page!!!
But how I can made it works in the "normal" conditions?
wohooo!, with the service and nginx finally working?
Unfortunately not, with a standard call of my IP I have always the "Bad Gateway" error.
in the jurnactl command i see:
Dec 28 13:12:34 raspberrypi systemd[1]: Started Gunicorn instance to serve myproject.
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [998] [INFO] Starting gunicorn 19.10.0
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [998] [INFO] Listening at: unix:dashweb.sock (998)
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [998] [INFO] Using worker: sync
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [1003] [INFO] Booting worker with pid: 1003
**Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [1003] [ERROR] Exception in worker process**
Dec 28 13:12:38 raspberrypi gunicorn[998]: Traceback (most recent call last):
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/arbiter.py", line 586, in spawn_worker
Dec 28 13:12:38 raspberrypi gunicorn[998]: worker.init_process()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/workers/base.py", line 135, in init_process
Dec 28 13:12:38 raspberrypi gunicorn[998]: self.load_wsgi()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
Dec 28 13:12:38 raspberrypi gunicorn[998]: self.wsgi = self.app.wsgi()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
Dec 28 13:12:38 raspberrypi gunicorn[998]: self.callable = self.load()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
Dec 28 13:12:38 raspberrypi gunicorn[998]: return self.load_wsgiapp()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
Dec 28 13:12:38 raspberrypi gunicorn[998]: return util.import_app(self.app_uri)
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
Dec 28 13:12:38 raspberrypi gunicorn[998]: __import__(module)
**Dec 28 13:12:38 raspberrypi gunicorn[998]: ModuleNotFoundError: No module named '007'**
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [1003] [INFO] Worker exiting (pid: 1003)
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [1004] [INFO] Booting worker with pid: 1004
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [1005] [INFO] Booting worker with pid: 1005
Dec 28 13:12:38 raspberrypi gunicorn[998]: [2020-12-28 13:12:38 +0000] [1004] [ERROR] Exception in worker process
Dec 28 13:12:38 raspberrypi gunicorn[998]: Traceback (most recent call last):
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/arbiter.py", line 586, in spawn_worker
Dec 28 13:12:38 raspberrypi gunicorn[998]: worker.init_process()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/workers/base.py", line 135, in init_process
Dec 28 13:12:38 raspberrypi gunicorn[998]: self.load_wsgi()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
Dec 28 13:12:38 raspberrypi gunicorn[998]: self.wsgi = self.app.wsgi()
Dec 28 13:12:38 raspberrypi gunicorn[998]: File "/home/pi/dashboard/www/dashenv/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
Dec 28 13:12:38 raspberrypi gunicorn[998]: self.callable = self.load()
Is this the problem?
Dec 28 13:12:38 raspberrypi gunicorn[998]: ModuleNotFoundError: No module named '007'
can you try to put the -m before the 007 in the service file
and restart the service
I've already done this correction, my file now is:
[Unit]
Description=Gunicorn `instance` to serve myproject
After=network.target
[Service]
User=pi
Group=www-data
WorkingDirectory=/home/pi/dashboard/www
Environment="PATH=/home/pi/dashboard/www/dashenv/bin"
ExecStart=/home/pi/dashboard/www/dashenv/bin/gunicorn --workers 3 --bind unix:dashweb.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
and it gave you that problem after adding the -m?
can you try once again to reload the service and the daemon sudo systemctl daemon-reload sudo systemctl restart Dashweb (your service name)
if its not working restart the pi to see it if loads the correct confs
I'm out for the today, but I'll be back later to help you with this
and it gave you that problem after adding the -m?
can you try once again to reload the service and the daemon sudo systemctl daemon-reload sudo systemctl restart Dashweb (your service name)
if its not working restart the pi to see it if loads the correct confs
Have done all of this but nothing. The problem is alway the "dashweb.sock" file that dowesn't exist as you can see in the error.log of the nginx:
2020/12/28 13:42:08 [crit] 590#590: *1 connect() to unix:/home/pi/dashboard/www/Dashweb.sock failed (2: No such file or directory) while connecting to upstream,....
I'm out for the today, but I'll be back later to help you with this
Really really many thanks for your support! You're really the best!! :top:
Hi all! I'm tryng to start up the server. Where I read "your domain" in the instruction, I write local Ip (192.168.x.x) right? Or the public IP? Sorry but I don't know how to continue because when I write the local IP of the raspberry in the browser I see only the standard "NGINX presentation page" and nothing else. If I write my public IP address I see my modem router configuration page. Can someone help me?