Skip to content

doriandarren/python.splytin.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Project

app.run(debug=True, host='0.0.0.0', port=5003)

Install Local

// Entorno virtual (https://flask.palletsprojects.com/en/3.0.x/installation/)
- python3 -m venv .venv
- source .venv/bin/activate     // MacOs
- .\.venv\Scripts\activate      // Windows
- pip install --upgrade pip
- deactivate                    // Deactivate



// Instala Flask:
- pip install Flask
- pip list                       // lista dependencias


//Borrar Entorno virtual
- Eliminar carpeta .venv
- python3.13 -m venv .venv
- source .venv/bin/activate
- pip install --upgrade pip


// Export server requeriments
// LOCAL Create file Requerimets (local)
pip freeze > requirements.txt


// Import server requeriments  (Plesk)
// PLESK Import
pip install --upgrade pip
pip install -r requirements.txt

pip3 install --upgrade pip
pip3 install -r requirements.txt




// Run server
flask --app index --debug run     //debug
flask --app index run             // Sin debug

Install Server (Servidor Plesk)

// Instala los requirimientos:
pip install -r requirements.txt

// Luego:
pip install Flask
pip install gunicorn


// PLESK Servidor - WSGI (es el que tengo que buscar)
// Configurar en Dominio -> Apache & nginx Settings -> Additional directives for HTTPS. El servicio se ejecutará con Apache y escribir:

...
<Location "/">
	ProxyPass http://localhost:8000/
	ProxyPassReverse http://localhost:8000/
</Location>
...


// Luego para iniciar el servidor (solo para probar)
gunicorn index:app


// importate: se agrego Gunicorn como un servicio con systemd

sudo nano /etc/systemd/system/gunicorn.service
...
[Unit]
Description=Gunicorn instance to serve python.splytin.com
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/vhosts/splytin.com/python.splytin.com
ExecStart=/var/www/vhosts/splytin.com/python.splytin.com/venv/bin/gunicorn --workers 3 --bind 0.0.0.0:8000 index:app

[Install]
WantedBy=multi-user.target
...


sudo systemctl daemon-reload
sudo systemctl start gunicorn
sudo systemctl enable gunicorn
sudo systemctl status gunicorn

// y para los cambios
sudo systemctl restart gunicorn

Install python-dotenv

pip install python-dotenv

Install ORM Flask-SQLAlchemy

pip install Flask-SQLAlchemy

About

Python Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages