Http://www.jianshu.com/p/91047e3a4ee9
Put the item on git, then upload ssh on pathonanywhere to git, create it first, and then copy the project from git to the root of Pathonanywhere/home/xqnq2007
1 Create a virtual environment,
mkvirtualenv rango
Install various packages in a virtual environment, which avoids some problems with insufficient permissions
2
Configure Virtualenv
Write the corresponding file path correctly
Once the web app is created, the Web
Web App-related configuration information you created will appear on the tab page, which I call the Project management page. In this page find Virtualenv
, click Enter a path to a virtualenv, if desired
, replace with your own virtualenv
path, such as: /home/<username>/.virtualenvs/rango
.
3
Configuring WSGI Code
On the Project management page WSGI configuration file: [/var/www/<username>_pythonanywhere_com_wsgi.py]
, click the py file, keep the following code, and delete (or comment out) the rest of the code:
# +++++++++++ Django +++++++++++# to use your own Django app with code like this:Import OSImport sys### Assuming your Django settings fileIsAt'/home/<username>/mysite/mysite/settings.py ' # #And your manage.pyIsIsAt'/home/<username>/mysite/manage.py 'Path ='/home/<username>/tango_with_django 'IfPathNotIn Sys.Path:sys.Path.append (Path) #os. environ[' Django_settings_module '] =' Tango_with_django_project.settings ' # # #ThenFor Django >=1.5:from Django.core.wsgiImport get_wsgi_applicationapplication = Get_wsgi_application () # #OrFor older Django <=1.4#Import django.core.handlers.wsgi#application = Django.core.handlers.wsgi.WSGIHandler ()
4 Configuring Static files
Found on the Project management pageStatic files
ClickEnter URL
Input/static/admin
, click the correspondingEnter path
Input/home/<username>/.virtualenvs/rango/lib/python2.7/site-packages/django/contrib/admin/static/admin
, the above steps add aadmin
The static file of the relevant page, add the static file in the app below, click againEnter URL
Input/static/
, click the correspondingEnter path
Input/home/<username>/tango_with_django/static/
。
Here Tango with Django's tutorial also has a pit, which corresponds to the/static/
Ofpath
For/home/<username>/tango_with_django/tango_with_django_project/static
, one more of the pathstango_with_django_project
,
5 Importing the database, importing it from the command line in bash
debugging tips, see error log
http://blog.csdn.net/zhu_free/article/details/46279725
https://my.oschina.net/hding/blog/615243
1190000009240824
https://www.v2ex.com/t/195207
Http://www.cnblogs.com/kuihua/p/5577276.html
Http://www.cnblogs.com/llw1121/p/6957039.html
Deploying a Django Project on Pythonanywhere