Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Django Girls Workshop Montreal - Environment setup

vkmc
April 01, 2015

Django Girls Workshop Montreal - Environment setup

Getting our development environment ready for the Django Girls Workshop in Montreal for PyCon 2015. Includes installation of Python 3.4, PIP, Virtualenv and Django for Mac OS X and Windows.

vkmc

April 01, 2015
Tweet

More Decks by vkmc

Other Decks in Programming

Transcript

  1. Text editor You will be working with a lot of

    different text files, so its a good idea to get a text editor. Some options: Notepad++ (Windows) Sublime (Mac OS X) Gedit (Both!)
  2. Python Python is a general-purpose, high-level programming language. Its design

    philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in other languages. $ python >>> print “Hello, world!” Hello, world! >>> exit()
  3. Install Python 3 (Mac OS X) 1. Get Python 3

    from https://www.python. org/downloads/mac-osx/ 2. Double click on the installer and follow the instructions for installing Python 3.4.3 on your Mac. 3. Typing python3 in your shell will open your Python 3 interpreter. Note: Mac OS X comes with Python 2.7 preinstalled. We will be using Python 3 though. Note: More information on how to use Python 3 in Mac OS X can be found in https://docs.python. org/3/using/mac.html
  4. Install Python 3 (Windows 8) 1. Get Python 3 from

    https://www.python. org/downloads/windows/ 2. Double click on the installer and follow the instructions for installing Python 3.4.3 on your Windows. 3. Typing python3 in your shell will open your Python 3 interpreter. Note: More information on how to use Python 3 in Windows can be found in https://docs.python. org/3/using/windows.html
  5. Python PIP PIP is a package management system used to

    install and manage software packages written in Python. Many packages can be found in the Python Package Index (PyPI). PIP is a recursive acronym that can stand for either "Pip Installs Packages" or "Pip Installs Python". $ pip install some-package-name $ pip uninstall some-package-name $ pip show some-package-name
  6. Install PIP Mac OS X 1. Open a shell 2.

    Run sudo easy_install pip Windows 1. Get PIP from https://pip.pypa.io/en/latest/installing.html 2. Run python get-pip.py Note: Starting from Python versions 2.7.9 and 3.4.0, pip is already included in the regular install
  7. Virtualenv A Virtual Environment is a tool to keep the

    dependencies required by different projects in separate places, by creating virtual Python environments for them. Keeps your global site- packages directory clean and manageable. For example, you can work on a project which requires Django 1.3 while also maintaining a project which requires Django 1.0.
  8. Start a new virtualenv 1. Create and open a new

    directory $ mkdir djangogirls $ cd djangogirls 2. Create the virtualenv $ python3 -m venv myvenv (Mac OS X) $ C:\Python34\python -m venv myvenv (Windows) 3. Start your virtualenv $ source myvenv/bin/activate (Mac OS X) $ myvenv\Scripts\activate (Windows)
  9. Django Django is a free and open source web application

    framework, written in Python. A framework is a set of components that helps you to develop websites faster and easier. Frameworks exist to save you from having to reinvent the wheel and help alleviate some of the overhead when you’re building a new site.
  10. Install Django Now that we have PIP and our virtualenv

    activated, installing Django can be done with: $ pip install django==1.7.1
  11. Run Django 1. Start a new project with $ django-admin

    startproject mysite . (Mac OS X) $ python myvenv\Scripts\django-admin.py startproject mysite . (Windows) 2. Configure the timezone $ gedit mysite/settings.py USE_TZ = False TIME_ZONE = 'Europe/Berlin' Note: You can look for your timezone in http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  12. Run Django 3. Start the database. We could select the

    database we want by modifying mysite/settings.py. We are going to use the default, sqlite 3. $ python manage.py migrate 4. Start the server $ python manage.py runserver 5. Open a browser and go to 127.0.0.1:8000
  13. Resources Django Girls Tutorial: http://tutorial.djangogirls. org/en/index.html Django Developers Documentation: https://docs.

    djangoproject.com/en/1.8/ Python Developers Documentation: https://www.python.org/doc/