Flask / uWSGI / CentOS - updates do not work

to be honest i am a Noob if it comes to servers & maintenance.

I followed exactly the following guide to create my first "Hello There" page which worked out so far.

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-centos-7

But after trying to update my homepage by inserting more code into my Application and saving the script the server output in my Browser still remains the same old "hello there".

I am better with functional programming (mathematics) and database handling, but since I have to supply my team colleagues with some tools i thought about a quick homepage. Unfortunatley it is harder than expected to set up a python hp.

Thank you in advanced Stefan

EDIT: I really followed the link above 1 to 1. Ht here are my codes:

TAOWeb.py

from flask import Flask, render_template

application = Flask(__name__)

@application.route("/")
def hello():
return "<h style='color:green'> HELLO ASDF! </h1>"


if __name__ == "__main__":
application.run(host='0.0.0.0')

TAOWeb.ini

[uwsgi]
module = wsgi

master = true
processes = 5

socket = TAOWeb.sock
chmod-socket = 660
vacuum = true

die-on-term = true

wsgi.py

from TAOWeb import application

if __name__ == "__main__":
    application.run()

and the /etc/systemd/system/TAOWeb.service

[Unit]
Description=uWSGI instance to serve TAOWeb
After=network.target

[Service]
User=tao
Group=nginx
WorkingDirectory=/home/tao/TAOWeb
Environment="PATH=/home/tao/TAOWeb/env/bin"
ExecStart=/home/tao/TAOWeb/env/bin/uwsgi --ini TAOWeb.ini

[Install]
WantedBy=multi-user.target

Last but not least the nginx Config:

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
    listen 80;
    server_name 185.164.5.211;

location / {
    include uwsgi_params;
    uwsgi_pass unix:/home/tao/TAOWeb/TAOWeb.sock;
    }

}

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  _;
    root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
   }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2 default_server;
#        listen       [::]:443 ssl http2 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
#        ssl_session_cache shared:SSL:1m;
#        ssl_session_timeout  10m;
#        ssl_ciphers HIGH:!aNULL:!MD5;
#        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }

}

It is the standard config with only included the 1st Server part.

Does this help?

Best Stefan

1 answer

  • answered 2018-07-11 22:20 Bayko

    If you are sure your code is right and are using Google chrome try clearing your cache