django 001

1.

http://www.w3cschool.cc/django/django-model.html

https://github.com/madre/JuYiGroup/blob/master/translated/Python/564955480-Djangorestframework/tutorial/1-serialization.md

 

   523  sudo easy_install pip
  524  sudo pip install django

  538  sudo easy_install MySQL-python
  539  python manage.py startapp TestModel

  549  python manage.py migrate
  550  python manage.py makemigrations
  551  python manage.py migrate

 sudo easy_install corsheaders

https://github.com/yzf/WeTalk

 

http://127.0.0.1:8000/login/?username=11&password=11

 

When you make a fresh app with a fresh database, you run the commands in following order:

1) python manage.py syncdb

This creates all the tables that will be used by django (eg :auth_group, auth_user) etc. You won't see your app's tables, after this command, in the database.

Then you do:

2) python manage.py makemigrations

This will run the initial migration and will detect all your new models.It just detects the models.Doesn't create tables in the database

After that,run the following command

3) python manage.py migrate

This will create your tables.

 

524  django-admin.py startproject HelloWorld

  525  cd HelloWorld/

  526  vi HelloWorld/view.py

  527  vi HelloWorld/urls.py 

  528  ls

  529  python manage.py runserver

  530  python manage.py startapp TestModel

  531  python manage.py syncdb

  532  python manage.py makemigrations

  533  ls

  534  python manage.py migrate

  535  ls

  536  python manage.py help

 

sudo pip uninstall django 

sudo pip install django

 

 

 

virtualenv env

create virtualenv

pip install -r requirements.txt

 

 

https://github.com/slaubenberger/walken

 

2.postgrepsql

 

brew install postgresql  

 

http://blog.csdn.net/u010211892/article/details/43472901

 

 

3. douban pypi

 

在终端进入目录: cd ~

如果没有 .pip 文件夹,那么就要新建这个文件夹,然后在.pip 文件夹内新建一个文件 pip.conf,

编辑 pip.conf 文件,写入

[global]

index-url = http://mirrors.aliyun.com/pypi/simple/

[install]

trusted-host=mirrors.aliyun.com

或者可以使用豆瓣的镜像:

[global]

index-url = http://pypi.douban.com/simple

[install]

trusted-host=pypi.douban.com

 

https://my.oschina.net/u/2377882/blog/485365 

 

4.utf8

 

#! usr/bin/python #coding=utf-8

manage.py

import sys
reload(sys)
sys.setdefaultencoding('utf8')
http://www.cnblogs.com/QuLory/p/3615584.html

 

 

5.requestcontext

http://www.cnblogs.com/jxrichar/p/3901320.html

 6.

No module named context_processors

 

setting.py

'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],

 

http://stackoverflow.com/questions/32828536/django-no-module-named-context-processors-error-after-reboot

 

 

http://stackoverflow.com/questions/32828536/django-no-module-named-context-processors-error-after-reboot

 

 7.render_to_response

 

The context_instance parameter in render_to_response was deprecated in Django 1.8, and removed in Django 1.10.

 

http://stackoverflow.com/questions/38739422/django-error-render-to-response-got-an-unexpected-keyword-argument-context-i/38739423

 

8.env

 

$ virtualenv venv
$ source ./venv/bin/activate


https://github.com/nitely/Spirit/tree/master/example
posted @ 2015-05-28 12:13  lianhuaren  阅读(96)  评论(0)    收藏  举报