GithubHelp home page GithubHelp logo

flask-foundation-mvc's Introduction

setup

note: this is a quick tutorial for centos7

make sure nginx is installed make sure to download a version of python3.x (I'm using 3.5 here)

clone the repo into /var/www/<app_name>/. Yes, put it inside <app_name>

replace every instance of <app_name> with whatever you want to call this thing

setup environment

create dir

mkdir /var/www/<app_name>/

change dir

cd /var/www/<app_name>/

create python3 virtual environment

virtualenv -p /usr/local/bin/python3.5 venv

activate venv

source venv/bin/activate

install requirements

pip install -r requirements.txt

exit venv

deactivate

create gunicorn daemon

create the daemon service file

vi /etc/systemd/system/<app_name>.service

[Unit]
Description=Gunicorn instance to serve <app_name>
After=network.target

[Service] 
User=root 
Group=nginx 
WorkingDirectory=/var/www/<app_name>/ 
Environment="PATH=/var/www/<app_name>/venv/bin" 
ExecStart=/var/www/<app_name>/venv/bin/gunicorn --workers 4 --bind unix:app.sock -m 007 wsgi --reload --error-logfile /var/www/<app_name>/error.log

[Install] 
WantedBy=multi-user.target

make it available

systemctl enable <app_name>

make nginx proxy

vi /etc/nginx/conf.d/<app_name>.conf

server {

    listen 80;

    server_name <website_name>.com www.<website_name>.com;

    access_log  /var/log/nginx/<app_name>-access.log;
    error_log  /var/log/nginx/<app_name>-error.log;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://unix:/var/www/<app_name>/app.sock;
    }

}

reload nginx

systemctl restart nginx

run it

systemctl start <app_name>

flask-foundation-mvc's People

Contributors

nivesnine avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.