A brief introduction to djangobook and virtualenv
Upcoming SlideShare
Loading in...5
×
 

A brief introduction to djangobook and virtualenv

on

  • 2,517 views

A brief introduction to djangobook ch2 and virtualenv/pythonbrew

A brief introduction to djangobook ch2 and virtualenv/pythonbrew

Statistics

Views

Total Views
2,517
Views on SlideShare
680
Embed Views
1,837

Actions

Likes
1
Downloads
15
Comments
0

2 Embeds 1,837

http://blog.samuelololol.org 1835
http://translate.googleusercontent.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

A brief introduction to djangobook and virtualenv A brief introduction to djangobook and virtualenv Presentation Transcript

  • Brief Introduction to DjangoBook & VirtualenvCh2. Getting Started, and virtualenvSamuel Chen,aka. samuelolololMay 28, 2013samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 1 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: StudyingPyramid/Djangosamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 2 / 14
  • Outline1 VirtualEnvvirtualenvpythonbrewpip2 DjangoBook Ch2Getting Startedsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 3 / 14
  • VirtualEnv virtualenvVirtualenvInstall ‘virtualenv‘ from the package system of the distribution(Linux)Install the package within the ‘virtualenv‘ environmentRun the program in ‘virtualenv‘ environment (development &production)samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 4 / 14
  • VirtualEnv virtualenvusing virtualenvcommands$ virtualenv –note-site-packages env$ cd env && source bin/activate(ENV)$ pip install packages–note-site-packagesDo not give access to the global site-packages dir to the virtualenvironment0http://virtualenvwrapper.readthedocs.org/en/latest/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 5 / 14
  • VirtualEnv virtualenvusing virtualenvcommands$ virtualenv –note-site-packages env$ cd env && source bin/activate(ENV)$ pip install packagesactivate the virtual environment0http://virtualenvwrapper.readthedocs.org/en/latest/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 5 / 14
  • VirtualEnv virtualenvusing virtualenvcommands$ virtualenv –note-site-packages env$ cd env && source bin/activate(ENV)$ pip install packagesvirtualenvwrapper1$ mkvirtualenv env2(env2)$ workon env11http://virtualenvwrapper.readthedocs.org/en/latest/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 5 / 14
  • VirtualEnv pythonbrewPythonbrewPython version switchVirtualenv supported1http://pythonbrew.readthedocs.org/en/latest/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 6 / 14
  • VirtualEnv pythonbrewInstall pythonbrewcommands$ sudo pip install pythonbrew$ pythonbrew installsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 7 / 14
  • VirtualEnv pythonbrewInstall pythonbrewcommands$ sudo pip install pythonbrew$ pythonbrew install$HOME/.bashrc...[[ -s ¨$HOME/.pythonbrew/etc/bashrc¨ ]]&& source ¨$HOME/.pythonbrew/etc/bashrcsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 7 / 14
  • VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pythonbrew list$ pythonbrew use 2.7.3samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 8 / 14
  • VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pythonbrew list$ pythonbrew use 2.7.3versionSwitched to Python-2.7.3samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 8 / 14
  • VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pythonbrew list$ pythonbrew use 2.7.3samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 8 / 14
  • VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pythonbrew list$ pythonbrew use 2.7.3versionUsing ‘Python-2.7.3‘samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 8 / 14
  • VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create venv name -p 2.7.3$ pythonbrew venv list$ pythonbrew venv use venv namesamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 9 / 14
  • VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create venv name -p 2.7.3$ pythonbrew venv list$ pythonbrew venv use venv nameoutputCreating ‘ venv name ‘ environment into˜/.pythonbrew/venvs/Python-2.7.3samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 9 / 14
  • VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create venv name -p 2.7.3$ pythonbrew venv list$ pythonbrew venv use venv namesamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 9 / 14
  • VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create venv name -p 2.7.3$ pythonbrew venv list$ pythonbrew venv use venv nameprompt( venv name )$samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 9 / 14
  • VirtualEnv pipUsing pippip:https://pypi.python.org/pypi/virtualenvcommands$ (env) pip freeze requirements.txt$ (env) pip install -r requirements.txtexport PIP DOWNLOAD CACHE2requirements.txt(env)$ pip freezeCython==0.16Django==1.4.5...2stackoverflowsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 10 / 14
  • VirtualEnv pipUsing pippip:https://pypi.python.org/pypi/virtualenvcommands$ (env) pip freeze requirements.txt$ (env) pip install -r requirements.txtexport PIP DOWNLOAD CACHE2requirements.txt(env)$ pip freezeCython==0.16Django==1.4.5...2stackoverflowsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 10 / 14
  • VirtualEnv pipUsing pippip:https://pypi.python.org/pypi/virtualenvcommands$ (env) pip freeze requirements.txt$ (env) pip install -r requirements.txtexport PIP DOWNLOAD CACHE22stackoverflowsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 10 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangoadd .pth filestart projectrunserver (developmentmode)2.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangogit trunkpip install djangoadd .pth filestart projectrunserver (developmentmode)commands$ git clonehttps://github.com/django/djangodjmaster$ pip install djangotarball: download2.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangoadd .pth filestart projectrunserver (developmentmode)site-packages/django.pth/home/user/djmaster2.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangoadd .pth filestart projectrunserver (developmentmode)command(ENV)$ django-admin.pystartproject mysite2.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangoadd .pth filestart projectrunserver (developmentmode)mysite—– manage.py—– mysiteinit .pysettings.pyurls.pywsgi.py2.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangoadd .pth filestart projectrunserver (developmentmode)(ENV)$ python manage.pyrunservermysite—– manage.py—– mysiteinit .pysettings.pyurls.pywsgi.py2.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall djangoadd .pth filestart projectrunserver (developmentmode)commands(ENV)$ python manage.pyrunserver 8080(ENV)$ python manage.pyrunserver 0.0.0.0:80802.pth: http://www.djangoproject.com/r/python/site-module/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 11 / 14
  • django ch2database packagesPostgreSQL: psycopg, psycopg23SQLite3: default supportedMySQL: mySQLdb4Oracle: cx Oracle53http://www.djangoproject.com/r/python-pgsql/4http://www.djangoproject.com/r/python-mysql/5http://cx-oracle.sourceforge.net/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 12 / 14
  • django ch2folder and filesdjango-admin.pymysite/manage.pymysite/ init .pymysite/settings.pymysite/url.pymysite/wsgi.pysamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 13 / 14
  • django ch2Thank YouThank You!samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 14 / 14