from http://rodrigothescientist.wordpress.com/2012/08/03/setting-up-pythondjango-project-using-intellij-11/

Setting up Python Django project using IntelliJ 11

Introduction

This article helps you set up a Python/Django project using IntelliJ 11 on a Windows 7 machine. This article assumes you have Python 2.7.2 SDK and Django 1.5 correctly set up, with all environment variables necessary.

Install Python plugin for IntelliJ

  1. Go to File | Settings | Plugins | Browse Repositories
  2. Search for Python. The latest version at the time of this post was 2.9.2. Install it.
  3. Restart IntelliJ when prompted.

Creating the project from scratch.

  1. Important! Go to File | New Project… | Create project from scratch
  2. If you are creating a project from existing project files, browse to the location underProject files location:
  3. Specify that it is a Python Module under the Select type and click Next.
  4. Select the python interpreter and click next.
  5. Select Django and input a project name, and application name.

Specifying File Types

If IntelliJ doesn’t recognize your Python file types, do the following.

  1. Go to File | Settings | File Types |
  2. Under Recognized File Types, make sure Python files has *.py and *.pyw

Specify Project Settings

  1. Go to File | Project Structure
  2. Under Project, make sure Project SDK: is Python 2.7.2 (C:/Python27/python.exe). The path might be different according to your Python27 location.

    1. If no SDK is specified, select New… | Python SDK |
    2. Browse to your python.exe file (should be something like C:\Python27\python.exe).
    3. All other settings in under Project do not matter. But mine were
      1. Project language level: 5.0 – ‘enum’ keyword, autoboxing, etc.
      2. Project compiler output: C:Users\rodrigo\Desktop\Projects\ssopy2\out
  3. Under Modules, make sure your project folder has a Django module. If it does not, add it with the [+] icon. (Important! If you did not create the project from scratch as specified above, you will not be able to add a Django module. You will have to delete this project, and go back to the top and create the project from scratch.)

    1. Make sure Settings: is ssopy2\settings.py (where ssopy2 is the name of your project)
    2. Make sure Manage script: is your manage.py file
  4. Under Facets, specify your Settings: and Manage script: as shown.
  5. Under SDKs,  Select your Python 2.7.2 SDK. Make sure Name: is Python 2.7.2 (C:/Python27/python.exe). This location may be different for you.

Run/Debug Configurations

If all above was done, you shouldn’t have to configure the Run/Debug configurations. But if they do not appear already, do the following.

  1. Under the Run/Debug Configurations (dropdown menu next to the Run Button), select Edit Configurations…
  2. Add a Django server if there is not one already.
  3. Everything should be set up so just have to make sure the Use SDK of Module: is selected for your project. In this case, ssopy2. Press OK.

Overall

If all above was done correctly, you are ready to work with Python and Django. You should also be able to add break points, and edit Python code with all properly highlighted keywords, and with Alt + Enter shortcuts. Enjoy!


'IT > python' 카테고리의 다른 글

Linter pylint is not installed and pip  (0) 2019.08.01
python virtualenv os x PIP BREW  (0) 2013.08.08
mac os x 에서 파이썬 python 업그레이드 하기...  (1) 2013.02.27

+ Recent posts