Categories
git

Initial Django Setup for itstock project

The following steps assume you’ve completed part 1 :http://www.davegernon.co.uk/techblog/django-setup-with-virtualenv-pycharm/

 

  1. Re-activate your virtual environment (where /code/env is the location you created the virtualenv)
    $ source ./code/env/bin/activate
  2. cd into the parent directory of the virtualenv (/code/) in this example:
    (env)$ cd ./code
  3. Create the django project named itstock:
    (env)~/code/itstock$ django-admin startproject itstock
  4. Now setup Git on the ./code/itstock directory by:
    (env)~/code/itstock$ git init ./
    (env)~/code/itstock$ git add ./
    (env)~/code/itstock$ git commit
  5. Next setup connection to the Bitbucket remote repository via:
     cd to the core directory of the project:

    (env)~/code/itstock$ cd ./itstock
  6. (env)~/code/itstock/itstock$ git remote add origin git@bitbucket.org:<username>/<name of repo>
    (env)~/code/itstock/itstock$ git push -u origin --all
    (env)~/code/itstock/itstock$ git push -u origin
  7. Integrate Bitbucket Git repo to Pycharm: 

    Launch pycharm and select the core directory [~/code/itstock/itstock in my case] as the location for the projectDownload the Bitbucket plugin from  https://plugins.jetbrains.com/plugin/?pycharm&id=6207Within Pycharm click : File > Settings > Plugins > Install plugin from disk…

    Then select the downloaded zip file and install.

    I got a bit lost then, you need to add the Bitbucket repo in when you want to push, maybe start with a PULL request to define that and then work from there.

  8. Ensure the db is migrated:
    Back in the terminal:

    (env)~/code/itstock$ python manage.py runserver <IP>:8080

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Categories
Uncategorised

django setup with virtualenv & PyCharm

Setting up my django development (basic).

The following steps assuming that Python is installed.

  1. Setup a repository on Bitbucket:
    Ensure my development machine has access via SSH keys
  2. Install pip on development machine:
    https://pip.pypa.io/en/stable/installing.html:
    To install pip, securely download get-pip.py
    Then run the following (which may require administrator access):

    $[sudo] python get-pip.py
  3. Install virtualenv on the development machine:
    https://virtualenv.pypa.io/en/latest/installation.html

    $ [sudo] pip install virtualenv
  4. Create a working directory for the project:
    $mkdir /path/to/project/root
  5. Create the virtual environment to work from:
    $virtualenv /path/to/project/root/env
  6. Activate the virtual environment:
    $source /path/to/project/root/env/bin/activate
  7. Install mysql-python:
    (env)$[sudo]apt-get install python-dev libmysqlclient-dev
    
    (env)$pip install MySQL-python
  8. Install django 1.7:
    (env)$pip install django==1.7

    exit the virtualenv for now by:

    (env)$ deactivate
  9. Install pycharm to manage the project from a GUI:
    First install java:

    $ sudo add-apt-repository ppa:webupd8team/java
    $ sudo apt-get update
    $ sudo apt-get install oracle-java8-installer
    $ sudo apt-get install oracle-java8-set-default

    Next install pycharm:

    Download from https://www.jetbrains.com/pycharm/download/
    or from a directory outside of your project directory:

    $ wget http://download.jetbrains.com/python/pycharm-community-4.5.3.tar.gz

    change to that directory and :

    $ tar -xvf pycharm-community-4.5.3.tar.gz

    now to launch pycharm:

    $ ./pycharm-community-4.5.3/bin/pycharm.sh

 

Django 1.7, mysql-python and the pycharm editor should now be ready to use!

 

Next: Setting up the itstock django project http://www.davegernon.co.uk/techblog/initial-django-setup-for-itstock-project/