Last active
December 12, 2018 04:16
-
-
Save wpupru/2f92ba0a1bb8a90008e3ac7ab4ec8f26 to your computer and use it in GitHub Desktop.
Установка_django_на_сервер
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Компиляции python 3.6 | |
| # sudo apt-get install -y make build-essential libssl-dev zlib1g-dev | |
| # sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm | |
| # sudo apt-get install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev | |
| # wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz | |
| # tar xzf Python-3.7.1.tgz | |
| # cd Python-3.7.1 | |
| # ./configure --enable-optimizations | |
| # make -j8 | |
| # sudo make altinstall | |
| # python3.7 | |
| echo 'alias python3.7="python3"' >> ~/.bashrc | |
| alias python3='python3.7' | |
| Создание базы данных | |
| # sudo -u postgres psql | |
| # CREATE DATABASE myproject; | |
| # CREATE USER user WITH PASSWORD 'password'; | |
| # ALTER ROLE user SET client_encoding TO 'utf8'; | |
| # ALTER ROLE user SET default_transaction_isolation TO 'read committed'; | |
| # ALTER ROLE user SET timezone TO 'UTC'; | |
| # GRANT ALL PRIVILEGES ON DATABASE chatdb TO user; | |
| #\q | |
| Настрока nginx | |
| server { | |
| listen 80; | |
| server_name 111.222.333.44; # здесь прописать или IP-адрес или доменное имя сервера | |
| access_log /var/log/nginx/example.log; | |
| location /static/ { | |
| root /home/user/myprojectenv/myproject/myproject/; | |
| expires 30d; | |
| } | |
| location / { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $server_name; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment