Maker/DIY
Engenharia Elétrica
Alguns programinhas
Economia
Assuntos Nerds
Fotografia
Marumaker
git clone [webapp github url] virtualenv -p python3 myenvfrom app import app
if __name__ == "__main__":
app.run()if __name__ == "__main__":
app.run()python wsgi.pypg_dump -d database_name -U username -h hostname > filename.dumpdeactivate
[Unit]
Description=Gunicorn instance to serve myproject
After=network.target
[Service]
User=username
Group=www-data
WorkingDirectory=/home/username/myproject
Environment="PATH=/home/maru/myproject/myenv/bin"
ExecStart=/home/maru/myproject/myenv/bin/gunicorn --workers 4 --bind unix:myproject.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.targetsudo systemctl start myprojectsudo systemctl enable myprojectYou will see something like this:
Created symlink /etc/systemd/system/multi-user.target.wants/myproject.service → /etc/systemd/system/myproject.service.sudo systemctl status myprojectserver {
listen 80;
server_name myproject.com www.myproject.com;
location / {
include proxy_params;
proxy_pass http://unix:/home/username/myproject/myproject.sock;
}
}sudo ln -s /etc/nginx/sites-available/myproject /etc/nginx/sites-enabledsudo nginx -tIf everything is OK the output looks like this:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfulsudo systemctl restart nginxCreate a new subdomain in digitalocean droplet
Create directory:
sudo mkdir -p /var/www/example.com/htmlsudo chown -R $USER:$USER /var/www/example.com/htmlsudo chmod -R 755 /var/wwwCreate the DB on your new local server
If DB exists => dump and restore.
Else => in the terminal run python and after import your app and run code:
$ python
>>>from app import db
>>>db.create_all()© Copyright 2019 marumaker.com