flask with no port number after url_for

Problem Description:

In the run locally flask project, when you run this code to the following, normal redirection

        return redirect(url_for('.script_case'))

But after project deployment to the server code runs a phrase, but reported a 404 Not Found

 

problem analysis:

  Carefully read the url is no port number.

  the correct address:

http://10.2.1.92:8001/script_case

  Actually requested address:

10.2.1.92/script_case

 

Solving steps:

  Find nginx configuration file

[root@67 ~]# find  / -name nginx.conf
/etc/nginx/nginx.conf

  Edit the nginx configuration file

nano /etc/nginx/nginx.conf

  Nginx running port number specified

 

    Test modification

sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

  Restart nginx Service

systemctl restart nginx.service

 

 

 

Reference documents:

 

flask url_for Image URL missing port number

 

Guess you like

Origin www.cnblogs.com/kaerxifa/p/11904835.html