Skip to content

Sprint 1 | Django Overview & GUI Design

Lenny edited this page Apr 12, 2019 · 24 revisions

Brief

The following wiki is to better prepare everyone for the upcoming session. The base of this page has 3 links, of those the first two serve as resources to familiarize yourselves with the content that we'll be practicing Friday. The final link is an instruction set to practice your new knowledge from the first 2 links, in your new Sandbox. Please follow the instructions included in the link.

Once you're comfortable, feel free to practice as much as you like. The Sandbox can be found here:

ENJOY!

Objectives

  1. Learn about the work environment
  2. To become familiar with the fundamentals of the Django framework
  3. Obtain a working knowledge of the collaboration flow (git flow) that will be used for the project
  4. Complete the first django exercise

PyStockAnalyze Environment Cheat Sheet

Repository Organization

The PyStockAnalyze repository is structured as follows:

PyStockAnalyze repository directory structure

  • build/ Contains the build virtual python environment in which all of the necessary packages required for the project have been installed
  • build/pydjango-build-env/ The Python Virtual environment--this includes the activate script that modifies the python instance that will be called when python is called from the commandline
  • tools/ Scripts required to setup the python environment for the project as well as run functions that are used often
  • src/ All python files and assets used within the PyStockAnalyze project
  • src/sandbox/ The folder in which all learning modules/exercises should be done--all files in this folder are ignored from the git history, making it an ideal place to work on experiments without having to be afraid of accidentally committing those changes into the project repository
  • src/pysdjango/ Contains the manage.py
  • src/pysdjango/pysdjango/ The main project folder--contains all of the applications and modules that are part of the project
  • src/pysdjango/pysdjango/ Files that are to be used in the project but not to be uploaded onto the git repo are to be stored here

Assigning Issues

  • The following link shows you how to assign yourself to tasks

https://help.github.com/en/articles/assigning-issues-and-pull-requests-to-other-github-users

Git Flow Cheat Sheet

PyStockAnalyze Collaboration Workflow

The following wiki page explains all the steps to working together on a team for this project: https://github.com/NIAGroup/PyStockAnalyze-2019/wiki/Cheatsheet-%7C-Collaboration-Workflow

Django Framework Overview

  • Navigate to the following link and complete the instructions in the video series

https://github.com/NIAGroup/PyStockAnalyze-2019/issues/20

First Django Sandbox Exercise

The goal of the sandbox exercise is to start working on online Django learning modules without corrupting the project being worked on in the PyStockAnalyze sessions.

  • The project being worked on is stored in the src/pysdjango/pysdjango folder
  • The sandbox area is stored in the src/sandbox folder--all exercises should be done in this folder

To setup your environment to support the new sandbox area:

  • Navigate to your repository while in Git Bash
  • Copy the following code into a script called resynchronize_repository.sh
#!/bin/bash -e
PROJ_ROOT_DIR=$(git rev-parse --show-toplevel)
PROJ_LOCALENV_TMPDIR=$PROJ_ROOT_DIR/build/localenv_temp
PROJ_LOCALENV_DIR=$PROJ_ROOT_DIR/src/pysdjango/pysdjango/localenv

# Move unsaved versions of files in localenv folder to build folder temporarily
mkdir $PROJ_LOCALENV_TMPDIR
mv $PROJ_LOCALENV_DIR/*.py $PROJ_LOCALENV_TMPDIR

# Pull from remote origin
git pull

# Move files back into localenv folder
mv $PROJ_LOCALENV_TMPDIR/*.py $PROJ_LOCALENV_DIR
rm $PROJ_LOCALENV_TMPDIR -rf
  • Run script while in the repository
./resynchronize_repository.sh
  • The terminal should print something like the following:
$ ./resynchronize_repository.sh
Updating 3e0202f..a53e933
Fast-forward
 .gitignore                                         |  2 +-
 src/pysdjango/pysdjango/localenv/.gitignore        |  2 ++
 src/pysdjango/pysdjango/localenv/README.md         |  8 +++++
 src/pysdjango/pysdjango/localenv/localapikeys.py   | 36 ----------------------
 src/pysdjango/pysdjango/localenv/localuser.py      | 35 ---------------------
 src/pysdjango/pysdjango/localenv/localwebproxy.py  | 34 --------------------
 .../localenv/__init__.py => sandbox/README.md}     |  0
 tools/build_env.sh                                 | 23 +-------------
 8 files changed, 12 insertions(+), 128 deletions(-)
 create mode 100644 src/pysdjango/pysdjango/localenv/.gitignore
 create mode 100644 src/pysdjango/pysdjango/localenv/README.md
 delete mode 100644 src/pysdjango/pysdjango/localenv/localapikeys.py
 delete mode 100644 src/pysdjango/pysdjango/localenv/localuser.py
 delete mode 100644 src/pysdjango/pysdjango/localenv/localwebproxy.py
 rename src/{pysdjango/pysdjango/localenv/__init__.py => sandbox/README.md} (100%)