K
K
Kirill2021-08-19 14:06:16
Flask
Kirill, 2021-08-19 14:06:16

How to host a Flask site on TimeWeb?

I did everything according to this instruction: https://timeweb.com/en/help/display/DOC/Flask
Hello World!
I already have a ready project with a DB. How to download and configure it correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
ge, 2021-08-25
@krllssrgv

If on shared, then see the corresponding section of the documentation . Create an .htaccess that tells Apache to use mod_wsgi to run the script:

Options +ExecCGI
AddHandler wsgi-script .wsgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.wsgi/$1 [QSA,PT,L]

Example index.wsgi :
activate_this = 'ПУТЬ_ДО_ОКРУЖЕНИЯ/bin/activate_this.py'
exec(open(activate_this).read())
 
import sys
sys.path.insert(0, 'ПУТЬ_ДО_ПРОЕКТА')
sys.path.insert(1, 'ПУТЬ_ДО_ПАКЕТОВ_PYTHON')
 
from ИМЯ_МОДУЛЯ import app as application

R
RusiDev, 2021-08-20
@RusiDev

Reload nginx
sudo systemctl restart nginxin console

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question