- Flask - Python Based Web Framework Used
- Jinja2 - HTML Templating Language for Python
- Peewee - A small, expressive ORM used for database communications
- SQLite - SQL database engine
Cloud9 is the preferred tool for our software team while developing and debugging code. However, if you are new to cloud9, they did just recent start requiring a credit card to create an account. Therefore you may not want to use cloud9 as your development environment.
When you first log into your cloud9 account, select the tab that says workspaces. After you open this tab you should see an option to create a new workspace, it should look like the image below.
After you click the button go ahead and input a name and description for this workspace.
Note: The default for the workspace is to be public, it's important to NOT change this default option. The way that our system works is that it creates a virtual environment for the application to run on. The virtual environment requires the use of ports in order to access the application. If you may the workspace private, it can block these ports so that they can not be accessed. There may be a way around this; however, we just find it easier if you let the workspace be public.
Next, you will want to make sure you choose to clone your repo from bitbucket. You do this by adding your git URL using the SSH.
For Example:
git@bitbucket.org:<username>/<name_of_Repo>.git
If you are uncertain what your git ssh URL is you can find it at the top of the bitbucket page if you click the clone option.
Note: If you copy and paste this line make sure to remove the
git clone
at the front in order to ensure you only get the URL.
After you have entered in the URL, the last portion of the page asked you to choose a template. Please select the python option in order to have the workspace to run correctly.
All that is left is to hit the create workspace button and your workspace will be configured correctly.
After you have created your workspace, there are three additional steps that you will have to complete before your virtual environment will be completely operational.
Step One: Activate Your Virtual Environment
In order to do this, all you have to do is type: source setup.sh
into the Linux terminal. You might have to wait a minute or two as the tools you need for our application are downloaded into your virtual environment. However, after the setup is completed you should see the words (venv)
at the front of your terminal.
Note: In order for the application to work, you must activate the virtual environment. If you are not inside of the virtual environment you will see this error: Whenever you get this error just activate the virtual environment again by entering the command
source setup.sh
Also, If you ever want to deactivate the virtual environment for any reason just type
deactivate
into the terminal.
Step Two: Setup Your Database
A couple of elements are necessary in order to get your database established. The first step is creating the SQLite file, we can create the file in the desired location through the use of one of our scripts.
Create Database
By typing the command python reset-db.py
a database file containing the correct schemas will be created in the data directory with the name advancement.sqlite
.
Populate Database
The reset-db.py
will only create empty tables for you, in order to populate the database you will need to execute the command: python add_dummy.py
. This file will add dummy data to the system so that you can gauge how the system is supposed to run.
How to View the Database
Now that you have the database created and populated with data, you are probably asking yourself how do I see that? Our system development team likes to use a tool called DB Browser. This tool is a visual way of viewing and editing SQLite database files.
Step Three: Running the Application
The only remaining step to getting your development environment deployed is running the actual application. This can be achieved through the command python run.py
, when you run this command you should see a URL created for you.
The URL will take you to the application and allow you to see any changes you make to the system. That's all that has to be done in order to get the development environment created and ready for editing.
[TOC] #Installation#
##Requirements##
- python 2.7
- linux, unix, mac, windows(with attachments)
- git
-
** Fork ** the repository from BitBucket and rename the project
-
If working on a local machine, then clone the repo from your terminal.
-
If you are working from cloud 9 follow these steps for directions on how to setup cloud 9 with git.
-
After you have successfully clone the repo. Run:
source setup.sh
python app.py
If you are successful you will see something like:
Starting application
Running server at http://0.0.0.0:8080/
Click the link in your terminal to check if it deployed correctly.
- bcsr-flask
- App
-static
- js
- css
- img
-templates
- snips # A directory for partial html files
- start.html #This is an example of where your html files will go
-logic
- files that manipulate the database
- init.py
- allImports.py
- config.yaml
- models.py
- starty.py #This an example of where your controllers will go
- App
-static
- js
- css
- img
-templates
- snips # A directory for partial html files
- start.html #This is an example of where your html files will go
-logic
- files that manipulate the database