Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.

Assignments

Sion edited this page May 16, 2019 · 7 revisions

WebUI team developing history summary

Read the following link in detail to understand the work has been done and the plans for the future of WebUI team.
https://docs.google.com/document/d/1PSw2Vx8fuQjnxWGf70Zro-8MIPzSK1zYLkr_un_tEBw/edit?usp=sharing

Setup

Setup: Install a virtual environment to develop with Django and Heroku.
Note: This is an important habit as a programmer for future reference since the system envirnment can be different and complicated in most cases. E.g. MacOS doesn't give user the re-write authority of some system root files for security sake, which includes initial python version that creates problems when downloading dependencies.

Installing Dependencies:

Note: Check the versions of dependencies installed in your environment first. There's no need to reinstall dependency files if yours have been updated to latest version.

(for Linux)
sudo apt-get install
(for MacOS)
Install them one by one e.g. 'pip install django'

  • python-dev
  • libpq-dev
  • python3-pip
  • python3-venv

Creating Virtual Environment

Create venv:

 python3 –m venv venv

Start virtualenv:

 source venv/bin/activate

Upgrade pip:

 (venv)$ pip install --upgrade pip

Install packages:

 (venv)$ pip install django

Check Django Version:

 (venv)$ django-admin --version

I. Experience Django Project structure

1. Create a html file for the webpage, css for design, and javascript for functionality.

TIP: Get the webapp working locally using a IDE such as Brackets to see the live site before staring Django the part. Remember when implementing the google maps part you need the api key which you can get from here

Once you're finished, the webpage should look similar to this demo

2. Create a Django app with the existing working app above.

TIP: You can follow this tutorial found on Youtube.
Note: Only the episode 1-3 have the knowledge that would be required to complete the training process. They are really good resources for beginners getting familliar with django web development so watch them carefully.

  • Make sure all Python and Django versions are up to date.
  • Urls.py is different in Django 1.10.

3. Create the Heroku app once you can locally deploy with Django

Basically you will need to create 3 main files.

  • /requirements.txt
  • /runtime.txt
  • /Procfile

Here are some good guides:

Configuration problems, tips, and guides


Problems occurred in the past:

  • Django App not working and giving me import errors.

    • Fix: Check the wgsi file and make sure all dependencies are also installed.
  • Showing lack of environment variables when deploying on Heroku.

    • Fix: Ask your team leader for related information.
  • Heroku app was not deploying. Forgot to install whitenoise and caused a error. Errors will prevent you from deploying.

  • Read/watch through the provided resources in details. Patience is vital at the beginning stage.

   

II. Using Restful APIs

sample: time-map with additional content

API source: ipstack.com

General Overview:
part of the webUI team responsibility involved delivering products to the front end. These products often relied on API that ease the access to the providers' database. Thus, we use a lot of different APIs that were built in different ways. This is an introduction to you in using an API and deliver it to front end so you may have an exposure to how a Django project is structured.

Minimum Requirements:

  • You have done the "Experience Django Project Structure" first assignment.
  • display the following data: ip, city, capital, native
  • Continue on the time-map site of the first assignment.

Useful tools: postman API development environment.
                      the postman is a very useful tool to test the response of an API.

III. Travis CI integration and deployment

coming soon...

IV. Model - Databases

coming soon...

V. API authentication

coming soon...

VI. Data encoding and decoding in Django project

coming soon...

VII. Development workflow in Git

coming soon...