Using WebPy as a Static HTTP Content Server

How can I configure WebPy to use it for static content across multiple websites?

I run two websites on the same IP address, using web.subdomain_applicationname-based virtual hosting. The intended solution for hosting static content is to create a directory static/in the directory containing the HTTP server script, and place all the static files from both websites.

However, even if I create subdirectories site1/and site2/inside static/to organize my resources could be requested Site1 resources, say http://site2.com/static/site1/foo.css. It seems natural to me to limit such cross-site access to resources.

How to serve static things for two sites separately in WebPy?

+3
source share
1 answer

I prefer to use nginx to serve static content, for example:

location ~ ^/(static(/.*)?)$ {
    alias /srv/http/$1;
}

location / {
    include /etc/nginx/conf/uwsgi_params;
    uwsgi_pass unix:/tmp/my_webapp.sock;
}
+1
source

Source: https://habr.com/ru/post/1710745/


All Articles