Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 1.87 KB

File metadata and controls

66 lines (43 loc) · 1.87 KB

PythonPit

Examples for Python and Django from my blog.

There are two example sets; PythonSandBox and DjangoSandBox, please read the README.md for each project for additional setup and configuration information.

PythonSandBox has examples of Python and the standard library, DjangoSandBox has examples of Django.

Python 3.4

I was using Python 3.4 as this was the latest version available on my Linux box by default. You might want to check which version is in your path:

$ which python

Installation

To install the required dependant libraries use the requirements.txt contained in both PythonSandBox and DjangoSandBox:

pip install -r requirements.txt

To generate a requirements file or to see what libraries you current python environment has you can run pip freeze:

pip freeze
pip freeze > requirements.txt

More information about PIP.

Virtualenv, VirtualEnvWrapper, PyCharm

I personally use PyCharm which handles virtual environments automatically. There is a community version for free though the paid version is worth the money especially if you are going to work on Django.

Otherwise I would recommend Virtualenv which allows multiple isolate Python environments.

I would also recommend VirtualEnvWrapper which allows easier switching between virtual python environments.

With virtualenv:

pip install virtualenv
cd project_dir
virtualenv myvenv
$ source ~/.virtualenvs/myenv/bin/activate  

With virtualenvwrapper

$ pip install virtualenvwrapper
mkvirtualenv myenv
$ workon myenv                              

More information can be found here