安装django + mysql 开发环境。

# virtualenv

的环境是前两天安装好的,安装指令如下:

 1594  tar xvfz virtualenv-15.0.1.tar.gz 
 1595  ll
 1596  cd virtualenv-15.0.1/
 1597  ll
 1598  python setup.py install
 1599  sudo python setup.py install

virtualenvwrapper

这个也是前两天装好的,记不清具体过程了,翻了一下history看了一下,找到一条,不记得是不是了。

sudo pip install virtualenvwrapper

# mysql

这个很顺利,直截就装好了。

sudo apt-get install mysql-server

# django

pip install django
(py273) janl@janl-studio:~/code/python$ pip list
Django (1.9.5)
pip (8.1.1)
setuptools (20.7.0)
wheel (0.29.0)

django-bootstrap3

pip install django-bootstrap3
(py273) janl@janl-studio:~/code/python$ pip list
Django (1.9.5)
django-bootstrap3 (7.0.1)
pip (8.1.1)
setuptools (20.7.0)
wheel (0.29.0)

djangorestframework

pip install djangorestframework
pip install markdown
pip install django-filter

(py273) janl@janl-studio:~/code/python/django_code/mysite$ pip list
Django (1.9.5)
django-bootstrap3 (7.0.1)
django-filter (0.13.0)
djangorestframework (3.3.3)
Markdown (2.6.6)
pip (8.1.1)
setuptools (20.7.0)
wheel (0.29.0)

#MySQLdb

python manage.py migrate
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
pip install MySQL-python
sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-N54ETK/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-N54ETK/MySQL-python/setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-N54ETK/MySQL-python/setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

sudo apt-get install libmysqlclient-dev
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-i686-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
  _mysql.c:29:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1

sudo apt-get install python-dev
pip install mysql-python

然后就OK了,可以连上mysql数据库了。

(py273) janl@janl-studio:~/code/python/django_code/mysite$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
April 19, 2016 - 11:27:45
Django version 1.9.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /
[19/Apr/2016 11:28:08] "GET / HTTP/1.1" 200 1767
Not Found: /favicon.ico
[19/Apr/2016 11:28:08] "GET /favicon.ico HTTP/1.1" 404 1936

转载于:https://my.oschina.net/janl/blog/662516

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值