Creating a simple example to authenticate a React UI with a Python Django backend.
-
Install Django and Django Rest Framework:
pip install django djangorestframework django-cors-headers
-
Create a New Django Project:
{ | |
"Actors": [ | |
"Jennifer Aniston", | |
"Courteney Cox", | |
"Lisa Kudrow", | |
"Matt LeBlanc", | |
"Matthew Perry", | |
"David Schwimmer" | |
], | |
"Awards": "Won 6 Primetime Emmys. 78 wins & 231 nominations total", |
%(#(#%####(/% | |
(#%%%%%%%%%### | |
((###(((/////(#( | |
%((((((/(////(#( | |
%((###(((((((((( |
Knowledge is power | |
------------------ | |
A [Pen](https://codepen.io/housamz/pen/rggZJr) by [Housamz](https://codepen.io/housamz) on [CodePen](https://codepen.io). | |
[License](https://codepen.io/housamz/pen/rggZJr/license). |
{ | |
"emojis": [ | |
{ | |
"category": "smileys_people", | |
"shortcode": ":joy:", | |
"keywords": "happy silly funny smiley smileys cry crying weeping weep sob sobbing tear tears bawling laugh laughing lol rofl lmao lmfao hilarious ha haha laugh laughing lol rofl lmao lmfao hilarious ha haha emotion emotions emotional emotion emotions emotional sarcastic sarcasm sarcastic sarcasm", | |
"data-clipboard-text": "😂", | |
"data-emoji": "😂", | |
"title": "Face with Tears of Joy", | |
"#text": "😂" |
.controls-container | |
h3#headline Insert Names Here | |
small#subheader (separated by commas or new lines) | |
span#counter | |
textarea#names(rows="10", cols="40"). | |
Ben, David, Declan, Housam, Jeongtae, Kevin, Ming, Robin | |
small#counter | |
button#spin Spin The Wheel | |
button#remove Remove Winner | |
.container |
def dump(obj): | |
for attr in dir(obj): | |
print("obj.%s = %r" % (attr, getattr(obj, attr))) |
input = int(input("Enter your value: ")) | |
final = '' | |
for i in range(1, input + 1): | |
for j in range(input, 0, -1): | |
final += ' ' if (j < i) else str(j) | |
for j in range(2, input + 1): | |
final += ' ' if (j < i) else str(j) | |
final += '\n' |
import urllib.request | |
import json | |
book_ISBN = "9780307277671" | |
google_api = "https://www.googleapis.com/books/v1/volumes?q=isbn:" | |
with urllib.request.urlopen(google_api + book_ISBN) as f: | |
text = f.read() |