Brief Introduction to DjangoBook & VirtualenvCh2. Getting Started, and virtualenvSamuel Chen,aka. samuelolololMay 28, 2013...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Who Am ISamuel Chen(samuelololol)@TrendMicro2-3 Years in PythonLab DataCrawler: BeautifulSoupWeb framework: bottle.pyNow: ...
Outline1 VirtualEnvvirtualenvpythonbrewpip2 DjangoBook Ch2Getting Startedsamuelololol Brief Introduction to DjangoBook & V...
VirtualEnv virtualenvVirtualenvInstall ‘virtualenv‘ from the package system of the distribution(Linux)Install the package ...
VirtualEnv virtualenvusing virtualenvcommands$ virtualenv –note-site-packages env$ cd env && source bin/activate(ENV)$ pip...
VirtualEnv virtualenvusing virtualenvcommands$ virtualenv –note-site-packages env$ cd env && source bin/activate(ENV)$ pip...
VirtualEnv virtualenvusing virtualenvcommands$ virtualenv –note-site-packages env$ cd env && source bin/activate(ENV)$ pip...
VirtualEnv pythonbrewPythonbrewPython version switchVirtualenv supported1http://pythonbrew.readthedocs.org/en/latest/samue...
VirtualEnv pythonbrewInstall pythonbrewcommands$ sudo pip install pythonbrew$ pythonbrew installsamuelololol Brief Introdu...
VirtualEnv pythonbrewInstall pythonbrewcommands$ sudo pip install pythonbrew$ pythonbrew install$HOME/.bashrc...[[ -s ¨$HO...
VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pyt...
VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pyt...
VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pyt...
VirtualEnv pythonbrewUsing pythonbrewPython Version Switchcommands$ pythonbrew install 2.7.3$ pythonbrew switch 2.7.3$ pyt...
VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create...
VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create...
VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create...
VirtualEnv pythonbrewUsing pythonbrew virtualenvVirtualenv supportedcommands$ pythonbrew venv init$ pythonbrew venv create...
VirtualEnv pipUsing pippip:https://pypi.python.org/pypi/virtualenvcommands$ (env) pip freeze requirements.txt$ (env) pip i...
VirtualEnv pipUsing pippip:https://pypi.python.org/pypi/virtualenvcommands$ (env) pip freeze requirements.txt$ (env) pip i...
VirtualEnv pipUsing pippip:https://pypi.python.org/pypi/virtualenvcommands$ (env) pip freeze requirements.txt$ (env) pip i...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2Install DjangoDjango BookLink: http://django-book.readthedocs.org/en/latest/chapter02.htmlstepsvirtualenvinstall...
django ch2database packagesPostgreSQL: psycopg, psycopg23SQLite3: default supportedMySQL: mySQLdb4Oracle: cx Oracle53http:...
django ch2folder and filesdjango-admin.pymysite/manage.pymysite/ init .pymysite/settings.pymysite/url.pymysite/wsgi.pysamue...
django ch2Thank YouThank You!samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 14 / 14
Upcoming SlideShare
Loading in …5
×

A brief introduction to djangobook and virtualenv

2,498 views
2,451 views

Published on

A brief introduction to djangobook ch2 and virtualenv/pythonbrew

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,498
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

A brief introduction to djangobook and virtualenv

  1. 1. Brief Introduction to DjangoBook & VirtualenvCh2. Getting Started, and virtualenvSamuel Chen,aka. samuelolololMay 28, 2013samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 1 / 14
  2. 2. 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
  3. 3. 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
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. 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
  8. 8. 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
  9. 9. Outline1 VirtualEnvvirtualenvpythonbrewpip2 DjangoBook Ch2Getting Startedsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 3 / 14
  10. 10. 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
  11. 11. 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
  12. 12. 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
  13. 13. 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
  14. 14. VirtualEnv pythonbrewPythonbrewPython version switchVirtualenv supported1http://pythonbrew.readthedocs.org/en/latest/samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 6 / 14
  15. 15. VirtualEnv pythonbrewInstall pythonbrewcommands$ sudo pip install pythonbrew$ pythonbrew installsamuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 7 / 14
  16. 16. 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
  17. 17. 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
  18. 18. 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
  19. 19. 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
  20. 20. 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
  21. 21. 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
  22. 22. 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
  23. 23. 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
  24. 24. 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
  25. 25. 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
  26. 26. 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
  27. 27. 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
  28. 28. 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
  29. 29. 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
  30. 30. 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
  31. 31. 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
  32. 32. 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
  33. 33. 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
  34. 34. 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
  35. 35. 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
  36. 36. 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
  37. 37. django ch2Thank YouThank You!samuelololol Brief Introduction to DjangoBook & Virtualenv May 28, 2013 14 / 14

×