程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Django project migrating from local to Linux server

編輯:Python

One 、 background :

stay mac I wrote a project locally , Migrate to Linux centos6.8 On

Two 、 transfer

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


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved