table of Contents
@
premise
- He built himself a simple flask micro-channel public number
- Django find a blog site set up on github
- Ali has a cloud server
- There has been a real-name authentication domain
Requirements: run two programs simultaneously, using the same domain name to associate, the following are their own understanding, there are a lot of flaws
1.Git related
Upload private documents in public warehouse on githhub (configuration dependent) is not convenient, gitee (code cloud) have free permission to establish a private warehouse. Therefore, the use of cloud code, the code can be associated with cloud github account, a key import to establish their own engineering
clone my local code on Ali cloud server
first synchronized to the current code on github, and then synchronize from the gitee github project.
1. Cloning ssh public micro-channel number code
~python ~
git clone @ ....
Use ssh clone when the host's public key must be placed in remote repository (github, gitee) settings, use the http is not, because the use of cloned ssh when the current host of the repository can push to a remote repository
2. The profile is added, and track, because on github these configuration files are ignored upload. That put .gtignore, the file is ignored here in related lines of code to delete
~python~
git add conf
3. Submit to a local repository
~python~
git commit -m "addconf"
4. push remote repository to gitee private warehouse
-python~
git push origin master
Above are running in the win, because the configuration file in the win, but also easy to modify
and then use the same method, clone to Ali linux server in the cloud
there is no other branch, master branch is used, because the track remote branch, you are prompted to remote branch and the local branch name to be the same, I do not know if the wrong command, and then tracking code to switch to the master branch merge other branches will not be wrong
2. environment-related
django blog run need redis, mysql
in linux installation and operation are very troublesome, although the project has docker, but change the nginx configuration file time is always wrong, so just take your own environment
redis installation is in accordance with the rookie tutorial step by step get away with
rookie tutorial mysql installation is to learn, but is set to set the login name, the new database
setting and then project the corresponding configuration is good to get away
3.nginx related
nginx do not understand, look at the rookie tutorial, I need to use different second-level domain with a domain name to match different ports with a host running in my project flask write port 9999, django have to use port 9977, in nginx .conf configure the following can be run successfully, but the blog can not load static files, consider a static file path does not match when the match, leaving a hole, and after filling, the following main configuration file
server {
listen 80;
server_name hehe.bothsavage.club;
location = /hehe {
proxy_pass http://127.0.0.1:9999;
}
}
server {
listen 80;
server_name www.bothsavage.club;
location = / {
proxy_pass http://127.0.0.1:9977;
}
}
Achieved when running two sites at the same time
4.linux related
Installation Environment slight trouble
in linux virtual environment do not understand
the different yum, apt-get useful
do not know where to put the files downloaded, but not the environment variables (it is called the win) and other
things do not understand ps aux displayed
in django, flask, time is running redis can not continue to enter commands
using the screen program, to solve this problem
1. open redis
~ ~ ~ Python
Create a window and into a place called reids
screen -S redis
Now this window, and find redis-server and run
./redis-server
~ ~ ~
2.Ctrl A + d exit redis window, return to the main window
~~~ python
Create a window called the flask and enter
-S flask Screen
Python run.py
~~~
3.Ctrl + D A flask exit window, return to the main window
~~~ python
Create a window and into a place called django
screen -S flask
python manage.py runserver 9977
~~~
About the Author
Personal blog site
personal GitHub address
individual public number: