2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DebianでFlask環境(virtualenv, gunicorn, nginx, postgresql)を作る

Posted at

タイムゾーンの設定

$ timedatectl set-timezone Asia/Tokyo
$ timedatectl #内容の確認

Flask、Nginxのインストール

$ apt-get install python3-pip python3-dev nginx

virtualenvのインストールと設定

$ pip3 install virtualenv
$ mkdir /var/www-app/
$ cd /var/www-app/
$ virtualenv venv
$ source venv/bin/activate
$ cd venv
$ pip install gunicorn
$ pip install flask

サーバーの起動

$ gunicorn --workers 2 --worker-class gevent app:app &

PostgreSQLのインストール

$ apt-get install openssl libssl-dev libssl-doc
$ apt-get install postgresql postgresql-contrib

DBとユーザーの作成

$ su postgres
$ psql
$ create database myapp_db;
$ create user myapp_db_user with encrypted password 'myapp_db_pass';
$ grant all privileges on database myapp_db to myapp_db_user;

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?