Ubuntu14: Install PyCharm Pro

First we need to install some dependencies.

Install JRE
Pycharm requires Java Runtime Environment (JRE) to work. You may want to consider getting Java Development Kit (JDK) as it contains the JRE and development tools in case you need to install it in the future. To install Oracle JDK I have written a guide here.

Install Python tools
The instructions for this depend on which version of python you intend to support in your application. Installing the following packages should ensure you have the necessary python tools.
sudo apt-get install python-setuptools

Optionally if you are using pip requirements in your project, or planning to deploy it you will most likely want to consider using PIP. It is a package installation tool.
sudo easy_install pip

Install Virtual Env
I’m pretty sure that virtual env is required to run pycharm. If not, it is a good option to help manage different environments for each project and I would recommend it regardless.
sudo pip install --upgrade pip virtualenv virtualenvwrapper

Install PyCharm (finally)
Download PyCharm Professional from this link. Students, there is an option to get a 1 year student license for the professional edition. You should read the details of the license (as I don’t know its details).

PyCharm should download as a tar.gz file. Once downloaded, open the terminal and move the the directory containing the tar.gz file.

To unpackage the tar.gz file:
tar -xzf pycharm*.gz

Optionally, you may want to extract the tar.gz file at a different location where you intend to use it.

To run pycharm you need to run pycharm.sh in the bin folder of the installation. Make sure to fill in the correct version number by replacing the Xs.
cd /pathtoinstallation/pycharm-5.X.X/bin

When you want to run, run the pycharm.sh file. But ensure you run with sudo privileges.
sudo ./pycharm.sh

Django 1.9 How to Setup ORM Models (Pycharm)

In this tutorial I will assume that you are using the Django module you created when you started the project (though it can be modified slightly if its a different module)

– models.py
– settings.py

I will assume that myapp is that original module you created and model.py is where your ORM models are.

Step 1:
Ensure that you list myapp under INSTALLED_APPS list in settings.py. It is not there by default!

Step 2:
Ensure that on top of models.py you have the following import
from django.db import models

Also as part of step 2 you may need other imports to use some of the default tables that come with Django. For example, I always use the auth_user table which requires:
from django.contrib.auth.models import User

Table Generation (Made Easy?)
Step 1:
In settings.py ensure you have the following code snippet present since it is defaulted as false
migrated = True

Step 2:
Run the following in command line from the project’s directory. You may need sudo privileges. Remember to change myapp to your app’s name.
./manage.py makemigrations
You may be required to specify myapp after makemigrations

Step 3:
You will have noticed that the above command would have made a directory migrations with file(s) in it.

The directory should have changed to look like this

– models.py
– settings.py
– migrations
– – 0001_initial.py

A file similar to the above will be generated, there is an option to name the file which can be found in the references.

Finally, run the following to have your tables generated in the database
./manage.py migrate

Model Meta Options – Discusses managed option
Django Models – Contains instructions for using models
Using migration to generate your tables