Skip to content

Instantly share code, notes, and snippets.

View prodeveloper's full-sized avatar

Jacob Chencha prodeveloper

View GitHub Profile
@prodeveloper
prodeveloper / deploying_simple_api.md
Last active May 21, 2023 06:21
Deploying your RESTful API to heroku

In this session, we are going to mimic a posts api that we worked on in a previous class. Typecode provides the free sample api.

APIs are what enable the backend, frontend and your mobile application to work together. We have also seen how to build basic REST api using Django Rest Framework

To get the post API to work we will need to work on four modules:

@prodeveloper
prodeveloper / deploying_to_heroku.md
Last active October 28, 2021 10:55
Deploying your application to a heroku server

For the lesson today, we are going to deploy our application to a live server.

The current workspace provided by cloud9 is meant only for development and not for production. By that, we mean you can use the service to write and even test your code but not to run your service.

For this we will be using a platform called heroku. Heroku is a PAAS (Platform As A Service).

This means you will not need to work VMs and such. Heroku will work with your code as long as you push it, which do using a similar technique.

The main things to consider when hosting your code will be:

@prodeveloper
prodeveloper / working_with_image.md
Last active January 5, 2021 14:51
How to upload and use images on your Django application

Working with images

We now have everything we need to build a web app, except for images and other binary files. Your application will likely not get a lot of engagement if its not visual. In this lesson, we shall be adding the ability to upload images to your Posts api.

Since this will be a continuation from the class on Deploying to production you are adviced to start by cloning that workspace and then working from there.

Step 1

@prodeveloper
prodeveloper / installing_django.md
Last active September 13, 2018 20:54
Installing Django on Cloud 9

In today's lesson we are going to look at installing django to cloud9.

Django is a web framework that will enable us to quickly write and deploy our web apps.

It's homepage defines it as:

    Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel.

Typically installations can be a bit painful involving setting up django and python involves a series of steps. Specifically

@prodeveloper
prodeveloper / index.html
Created June 19, 2018 07:00
Introduction to forms
{% extends 'layout.html'%}
{% block content%}
<body>
<div class="container">
<form action="{{url_for('results')}}" method = "POST">
<div class="form-group">
<label for="val1">Input value 1</label>
<input type="text" class="form-control" id="val1" placeholder="Value 1" name="val1">
@prodeveloper
prodeveloper / index.html
Created June 19, 2018 07:00
Introduction to forms
{% extends 'layout.html'%}
{% block content%}
<body>
<div class="container">
<form action="{{url_for('results')}}" method = "POST">
<div class="form-group">
<label for="val1">Input value 1</label>
<input type="text" class="form-control" id="val1" placeholder="Value 1" name="val1">
@prodeveloper
prodeveloper / dup_removal.py
Created May 2, 2018 06:45
Removing duplicates
def answer(numbers):
seen = set()
counter = 0
zero_counter=0
unique = []
duplicate_value=None
numbers.insert(0,0)
for x in numbers:
if x in seen:
duplicate_value = x
@prodeveloper
prodeveloper / exercise1.txt
Last active March 27, 2018 06:56
End of semester challenge
Write a script that converts celsius to farnheit
The formula for doing so would be:
(°C × 9/5) + 32 = °F or in plain English, Multiple by 9, then divide by 5, then
add 32.
The script should take input from STDIN.
@prodeveloper
prodeveloper / circle.py
Last active March 20, 2018 09:09
Class Demo for rectangle and circle
import math
class Circle:
radius = 0
def __init__(self,radius):
self.radius = radius
def validateDimension(self):
try:
self.width = float(self.radius)
@prodeveloper
prodeveloper / assignment.py
Created March 6, 2018 09:37
Validation and working with files 6th March
class Student:
def __init__(self, names, email):
self.names = names
self.email = email
self.validateEmail()
self.validateName()
def validateEmail(self):
pass