stay mac I wrote a project locally , Migrate to Linux centos6.8 On
2.0 mac Connect liunx
mac Connect liunx, In general, it is iterm2 . Need to upload / Download the file , It needs to be configured separately .( Search online )
If we use tools ,app store There are ZenTermLite
2.1 Confirm whether the server can connect to the Internet .ping Try an Internet connection
2.2 Whether the port is released , For example, I want to use 8000 The port starts the service , Whether it is released 8000 port .( Tencent cloud and so on need to be set and released separately )
2.3 python Environmental Science
Need to be in linux To build pyhton3 Environmental Science , And pip3
Let's Baidu it .
2.4 Activate the virtual environment in the project venv
Transfer the project to linux After that , You need to activate the virtual environment in the project venv
source venv/bin/activate
Then execute it inside python3 manage.py runserver 0000:8000
2.5 above , If startup fails , Hint not found django Of , Here, you need to set the path of the module reference
Add virtual environment environment variables
vim ~/.bash_profile
Add the following commands completely on the last line ,
export PYTHONPATH=/home/myproject/myapp/venv/Lib/site-packages
export LD_LIBRARY_PATH="/usr/local/lib"
/home/myproject/myapp/venv This is my own project , Depending on the path of the virtual environment
When the configuration is complete , Save and exit . Refresh the environment variables , Enable environment variables .
source ~/.bash_profile