DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Frameworks
  4. How To: Install a Full Development Environment for Django on Windows

How To: Install a Full Development Environment for Django on Windows

Everett Toews user avatar by
Everett Toews
·
Jan. 27, 12 · Interview
Like (0)
Save
Tweet
Share
9.90K Views

Join the DZone community and get the full member experience.

Join For Free
I recently installed a full development environment for Django on Windows 7 and found that it took longer than expected. The path to getting everything working together wasn't immediately apparent. I made a few missteps along the way and hopefully this post will make it a bit easier for the next developer.

The tools that I installed are:

  1. Python 2.7
  2. pip 0.8.2
  3. Postgres 9.0
  4. Django 1.3 Beta 1
  5. Intellij IDEA 10

Python


Just go to the Python download page and pick the version for you. I installed Python to C:\dev\tools\python27. Then I added C:\dev\tools\python27\Scripts and C:\dev\tools\python27 to my system PATH environment variable.

pip


To me it appears as though packaging in Python is in a painful disarray/flux. As far as I can tell pip is the way to go for Python 2.x. After reading What's the proper way to install pip, virtualenv, and distribute for Python? I did the following to get pip installed.

  1. Download http://python-distribute.org/distribute_setup.py to C:\dev\temp
  2. Ran command: cd C:\dev\temp
  3. Ran command: python distribute_setup.py
  4. Ran command: easy_install pip

Now that pip is installed we can:

  1. Install packages: pip install SomePackage
  2. Uninstall packages: pip uninstall SomePackage
  3. Upgrade packages: pip install --upgrade SomePackage

Plus a whole lot more. For me, the above is already enough to choose pip over easy_install.

Postgres


Go to the Postgres download page and install it.

Now you'll need a python-postgres database interface library. For this we'll use psycopg. Go to the win-psycopg download page and pick the version that most closely matches your Windows/Python/Postgres versions.

Note that when you start a Django project you'll want to use django.db.backends.postgresql_psycopg2 for your database ENGINE value in your settings.py.

Django


I wanted to take the latest beta release of Django for a spin so I didn't install it via pip. However, when Django 1.3 is released on January 31, 2011 I'll definitely be installing it with pip. Instead I more or less followed the Quick install guide for Installing an official release:

  1. Went to the Django download page and grabbed the latest tar.gz
  2. Extracted it to C:\dev\temp with 7-Zip
  3. Ran command: cd C:\dev\temp\Django-NNN
  4. Ran command: python setup.py install

After that's done you'll want to verify your install and try the tutorial.

While going through the tutorial I found that django-admin.py startproject mysite [was] not working well on windows 7. That's already been reported to the django project, see http://bugs.python.org/issue7936. Here's a solution:

  1. Open regedit
  2. Find python.exe (for instance, under HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command)
  3. Change "C:\dev\tools\python27\python.exe" "%1" to "C:\dev\tools\python27\python.exe" "%1" %*

I also stumbled onto a bug in Django on Windows, Cannot load admin interface static files when doing tutorial. Painful but something that should be fixed in the next beta release.

Intellij IDEA


Intellij IDEA has great support for Python and Django development. If you're strictly doing Python development you could just download PyCharm. However, I already had IDEA 10 already installed so I just added the Python plugin (essentially PyCharm) from File > Settings > Plugins.

To get IDEA working with an existing Django project (for instance, the Django tutorial) you have to jump through a few hoops. I followed the instructions from Using Intellij for Django Development.

Conclusion


It's a lot to do and a lot to configure but in the end it's worth it. Python/Django development is fast, effective and the end result can be some easily maintainable code.

 

Source: http://phymata.blogspot.com/2011/01/install-full-development-environment.html

Django (web framework) intellij Python (language)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Secure APIs: Best Practices and Measures
  • When to Choose Redpanda Instead of Apache Kafka
  • Java REST API Frameworks
  • Reliability Is Slowing You Down

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: