http://www.jianshu.com/p/91047e3a4ee9

将项目放到git上,然后将pathonanywhere上的ssh传到git上,没有的话先创建,然后从git上把项目拷贝到pathonanywhere的根目录下/home/xqnq2007下

1 创建虚拟环境,

mkvirtualenv rango
将各种包安装在虚拟环境中,这样会避免出现某些权限不足的问题 2

配置Virtualenv

将对应的文件路径写正确

创建web app成功后,在Web标签页面会出现你创建的web app相关配置信息,我称之为项目管理页面。在该页面找到Virtualenv,点击Enter a path to a virtualenv, if desired,替换成你自己的virtualenv路径,如:/home/<username>/.virtualenvs/rango

3

配置WSGI代码

在项目管理页面找到WSGI configuration file: [/var/www/<username>_pythonanywhere_com_wsgi.py],点击该py文件,只保留以下代码,其余代码删除(或注释掉):

# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
import os
import sys
#
## assuming your django settings file is at '/home/<username>/mysite/mysite/settings.py'
## and your manage.py is is at '/home/<username>/mysite/manage.py'
path = '/home/<username>/tango_with_django'
if path not in sys.path:
sys.path.append(path)
#
os.environ['DJANGO_SETTINGS_MODULE'] = 'tango_with_django_project.settings'
#
## then, for django >=1.5:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
## or, for older django <=1.4
#import django.core.handlers.wsgi
#application = django.core.handlers.wsgi.WSGIHandler() 4 配置静态文件
在项目管理页面找到Static files,点击Enter URL,输入/static/admin,点击对应的Enter path,输入/home/<username>/.virtualenvs/rango/lib/python2.7/site-packages/django/contrib/admin/static/admin,以上步骤添加了admin相关页面的静态文件;下面添加应用中的静态文件,再次点击Enter URL,输入/static/,点击对应的Enter path,输入/home/<username>/tango_with_django/static/
此处tango with django的教程还有个坑,它对应的/static/path/home/<username>/tango_with_django/tango_with_django_project/static,路径中多了一个tango_with_django_project
5 导入数据库,在bash 通过命令行导入
调试技巧,看error log
http://blog.csdn.net/zhu_free/article/details/46279725
https://my.oschina.net/hding/blog/615243
https://segmentfault.com/a/1190000009240824
https://www.v2ex.com/t/195207
http://www.cnblogs.com/kuihua/p/5577276.html
http://www.cnblogs.com/llw1121/p/6957039.html

在PythonAnyWhere上部署Django项目的更多相关文章

  1. 在Pythonanywhere上部署Django

    1 在github上创建一个仓库blog 2 克隆到本地,添加Django项目,再推送到github 3 克隆到pythonanywhere,以后每次更新用git pull即可 4 在pythonan ...

  2. 服务器上部署django项目流程?

    1. 简单粗暴 项目开发完毕,在部署之前需要再配置文件中将 ALLOWED_HOSTS配置设置为:当前服务器IP或*,如: ALLOWED_HOSTS = ["*",] 然后将源码 ...

  3. 基于Nginx和uWSGI在Ubuntu上部署Django项目

    前言: 对于做Django web项目的童鞋,重要性不言而喻. 参考:https://www.cnblogs.com/alwaysInMe/p/9096565.html https://blog.cs ...

  4. 在nginx上部署django项目--------Gunicorn+Django+nginx+mysql

    一.安装nginx 以前的博客我有写,这里就不写了 http://www.cnblogs.com/wt11/p/6420442.html 二.安装mysql 我用的mysql5.7  64位的二进制包 ...

  5. 在pythonanywhere上部署Django应用

    参考:https://tutorial.djangogirls.org/zh/deploy/ 资料讲的很明了,仅在设置上做几点补充. 1.设置相对路径 import os BASE_DIR = os. ...

  6. 云服务器上利用Docker部署Django项目

    转载别人的,请看下面链接 云服务器上利用Docker部署Django项目

  7. linux上使用nginx、uwsgi部署django项目

    参考:CentOS7下部署Django项目详细操作步骤 注意事项: 在虚拟环境中操作,虚拟环境中安装nginx.uwsgi,虚拟环境外需安装uwsgi -- 临时关闭防火墙:systemctl sto ...

  8. mac osx 上面部署Django项目 apache+mysql+mod_wsgi

    1.安装Xcode command line tools 首先,编译mysql和Homebrew需要用到Xcode command line tools,所以首先安装command line tool ...

  9. 使用uWSGI+nginx部署Django项目

    最近使用django写了一些项目,不过部署到服务器上碰到一些问题,还有静态文件什么的一堆问题,这里总结一下碰到的问题和解决方案,总体思路是按照官方文档走的. 原文地址:http://uwsgi-doc ...

随机推荐

  1. 【3Sum Closest 】cpp

    题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given ...

  2. seajs引入jquery

    seajs 2.2.1在config文件中preload一次jquery,就可以在整个项目中使用jquery.如下: seajs.on('exec', function(module) { if (m ...

  3. c++ primer plus 第6版 部分三 9章 - 章

    c++ primer plus 第6版                                               部分三 9章 - 章 第9章   内存模型和名称空间 1.单独编译 ...

  4. 聊聊、Integer 封装特性

    前几天在公司内部群,有人分享出了一道题,问谁能口算出来,他就膜拜那个人.题目如下: Class cache = Integer.class.getDeclaredClasses()[0]: Field ...

  5. xshell 连接redis

    当我们安装好redis 在本地测试启动,存,取都正常,但是无法远程连接redis. 在redis.conf的文件默认配置中有一配置是 bind 127.0.0.1,表示绑定访问该redis的地址只能是 ...

  6. C++ bitset类的使用与简介

    有些程序要处理二进制位的有序集,每个位可能包含的是0(关)或1(开)的值.位是用来保存一组项或条件的yes/no信息(有时也称标志)的简洁方法.标准库提供了bitset类使得处理位集合更容易一些.要使 ...

  7. Rust学习资源和路线

    Rust学习资源和路线 来源 https://rust-lang-cn.org/article/23 学习资源 The Rust Programming Language 堪称Rust的"T ...

  8. FZU Super A^B mod C(欧拉函数降幂)

    Problem 1759 Super A^B mod C Accept: 878    Submit: 2870 Time Limit: 1000 mSec    Memory Limit : 327 ...

  9. oracle存储过程、声明变量、for循环

    oracle存储过程.声明变量.for循环  1.创建存储过程 create or replace procedure test(var_name_1 in type,var_name_2 out t ...

  10. bzoj 3704 昊昊的机油之GRST 贪心dp,思维

    昊昊的机油之GRST Time Limit: 10 Sec  Memory Limit: 1024 MBSubmit: 80  Solved: 33[Submit][Status][Discuss] ...