Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hi,
I deployed a Flask app on an Ubuntu 18.04 VPS using Gunicorn and Nginx as the driving servers. I followed this official tutorial for help. I am using a separate server block for my domain on Nginx and not using the default.
The website loads just fine on my domain. However, there are two issues –
Interestingly, none of these issues exist when I run the Gunicorn instance on localserver (port 5000).
Details about the infinitely reloading route are –
It’s a separate blueprint for displaying and browsing tags that looks like this - @tags_bp.route('/<language>/tags/<selected_tags>', methods=['GET']).
This route renders a template with some responses.
There’s an allied route - @tags_bp.route('/<language>/tags/<selected_tags>/<variable_ID>', methods=['GET']) - that only returns a JSON object response to AJAX calls made by the JavaScript that then gets rendered on the page.
I am using the default .serivce and location block as shown below.
/etc/systemd/system/myproject.service
[Unit]
Description=Gunicorn instance to serve myproject
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/<USER>/myproject
Environment="PATH=/home/<USER>/myproject/myprojectenv/bin"
ExecStart=/home/<USER>/myproject/myprojectenv/bin/gunicorn --workers 3 --bind unix:myproject.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
/etc/nginx/sites-available/myproject
server {
listen 80;
server_name your_domain www.your_domain;
location / {
include proxy_params;
proxy_pass http://unix:/home/<USER>/myproject/myproject.sock;
}
}
I am suspecting the error is occurring somewhere between Nginx and Gunicorn. I have tried modifying the proxy_headers using this configuration on the Flask documentation but that didn’t help either.
Would greatly appreciate any help to fix this!
Cheers.
WildcatMedia
jeffs
0621335d663b4b699a60eb27e28153
accesstrax
Dwight Trumbower
admin
yimprogramming
samunyi90
1d6ce141ab5444dfb1ea2dd29cf4b1
Matt Fricker
joel9b158e40551b15093f213f