pythonanywhere搭建过程

来源:互联网 发布:小型组态软件 编辑:程序博客网 时间:2024/05/18 00:37

1.web建立django项目:在framework的时候选择Manual configuration
这里注意 如果是选择的django framework 后面的都会出错
2.使用bash的virtualenv创建项目mkvirtualenv django18
source django18/bin/activate

3.在virtualenv中安装django

pip install django==1.8 /home/yw/.virtualenvs/django18/local/lib/python2.7/site-packages/django

4.创建项目

django-admin startproject TeaGZcd TeaGZpython manage.py startapp TeaBusiness

5.添加virtualenv到pythonanywhere:/home/yw/.virtualenvs/django18
6.修改wsgi文件 删除所有处django之外的东西
取消以下语句的注释:

import osimport syspath = '/home/yw/TeaGZ'if path not in sys.path:sys.path.append(path)os.environ['DJANGO_SETTINGS_MODULE'] = 'TeaGZ.settings'from django.core.wsgi import get_wsgi_applicationapplication = get_wsgi_application()

7.reload
8.pip install mysql-python
9.设置static

path:/home/yw/.virtualenvs/django18/lib/python2.7/site-packages/django/contrib/admin/static/adminurl:/static/admin/path:/home/yw/TeaGZ/staticurl:/static/

10.在pythonanywhere上设置mysql

DATABASES = {    'default': {        'ENGINE': 'django.db.backends.mysql',        'NAME': 'username$TeaBusiness',        'USER':'username',        'PASSWORD':'password',        'HOST':'mysql.server',    }}

Git:
建立远程仓库

1.mkdir TeaGZ(django的project名称)2.cd !$(进入TeaGZ)3.git init(在TeaGZ中生成.git文件夹)4.git config --global user.email "your-email"5.git config --global user.name "your-username"pwd:Panda12086.git add TeaGZ(复制TeaGZ文件夹) TeaBusiness(复制TeaBusiness文件夹) manage.py(复制manage.py文件)7.git commit -m "project-initiation-introduction" (提交)8.在github上建立repository,并命名为TeaGZ.git9.git remote add origin https://github.com/username/your-repo.git (远程连接建立)10.git push -u origin master(将提交的文件和文件夹推送到远程TeaGZ.git中)

git clone

<repo URL from GitHub> https://github.com/username/your-repo.gitgit@github.com:username/your-repo.git

create a new repository on the command line:

git initgit add README.mdgit commit -m "first commit"git remote add origin https://github.com/username/your-repo.gitgit push -u origin master

push an existing repository from the command line

git remote add origin https://github.com/username/your-repo.gitgit push -u origin master

在另外一台电脑上获取并更新远程git库:

1.git clone https://github.com/sunshinezzz/TeaGZ.git (获取、复制)2.git config --global user.email "your-email"3.git config --global user.name "your-username"4.git add templates media static----------务必要确保这3个文件夹都不是空的  不然commit的时候会失败 提示你没有任何改动----------5.git commit -m "add routes for static files"6.git push -u origin master

如果其他文件更改后需要git远程更新的可重复步骤4-6

第一次使用git时:

https://help.github.com/articles/generating-ssh-keys/1. ssh-keygen -t rsa -b 4096 -C "email_address"  Enter  Enter2. ssh-agent -s3. ssh-add ~/.ssh/id_rsa  (very important)4. clip < ~/.ssh/id_rsa.pub and paste to the website5. ssh -T git@github.com  ->test$ git remote add origin git@github.com:username/learngit.git$ git clone git@github.com:michaelliao/gitskills.gitFor the very first time,before using git push, you have to use git pull first.git remote add origin git@github.com:username/learngit.git5. git add file6. git commit -m "description of this submission"git pull origion mastergit push -u origin mastergit remote -v查看是否名字写错了  如果错了用git remote remove origin 然后再用git remote addpush的文件夹不能为空  否则不会pushgit clone https://username:password@github.com/sunshinezzz/repo_name.git
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 小孩一洗澡就哭怎么办 孩子去外地上学学籍怎么办 非婚生子父亲想要孩子怎么办 非婚生子孩子父亲找不到了怎么办 3岁半宝宝认字怎么办 上课注意力不集中老是发呆怎么办 海绵宝宝吃了会怎么办 宝宝误吞李子核怎么办 24个月宝宝不愿意说话怎么办 孩子凉着肚子吐怎么办 教宝宝说话不会说怎么办 2岁宝宝语言退化怎么办 两周宝宝嗓子哑怎么办 幼儿园孩子上课爱说话老师怎么办 一岁宝宝不会爬怎么办 孩子说话不太清楚怎么办 十一个月宝宝不爱吃饭怎么办 14个月宝宝不爱吃饭怎么办 一岁宝宝喜欢哭怎么办 4岁儿童不会说话怎么办 8个月宝宝37.5度怎么办 8个月婴儿37.5度怎么办 5个月宝宝38度怎么办 5个月宝宝发烧怎么办 五个月小孩38度怎么办 宝宝3岁还不会说话 怎么办 两岁宝宝流口水厉害怎么办 两周宝宝不说话怎么办 两岁宝宝说话有点口吃怎么办 一周岁的宝宝脾气不好怎么办 九个月的宝宝脾气不好怎么办 两岁宝宝脾气不好怎么办 2岁宝宝脾气不好怎么办 3岁宝宝脾气不好怎么办 脾气不好吓到宝宝了怎么办 四个月宝宝脾气不好怎么办 5岁说话不清楚该怎么办 小孩快上幼儿园了不怎么说话怎么办 四岁宝宝吐字不清楚怎么办 孕28周胎儿腿短怎么办 b超显示腿短怎么办