Django Rest Framework

https://www.django-rest-framework.org/community/tutorials-and-resources/ This tutorial was used for 50%, the rest is my own demo: https://tests4geeks.com/django-rest-framework-tutorial/ Set up django: mkvirtualenv dapi navigate to your folder, then mkdir dapi cd dapi, setprojectdir . pip install django django-admin startproject api_apps Then you get the folder structure, run it: python manage.py runserver Go to http://localhost:8000/ The install worked successfully! Congratulations! […]

Whiteboard (Django 1-5)

Python 3.7 installed pip install virtualenv, virtualenvwrapper-win (remove -win for linux) pip freeze: C:\WINDOWS\system32>pip freeze pbr==5.2.1 six==1.12.0 stevedore==1.30.1 virtualenv==16.6.0 virtualenv-clone==0.5.3 virtualenvwrapper-win==1.2.5 mkvirtualenv whiteboard cd and mkdir into app folder, then setprojectdir . (env) pip install django (env) python -m django –version Then we can start the project: django-admin startproject whitebo Then we get the frame […]

Django database API foreign key 102

https://docs.djangoproject.com/en/2.0/topics/db/queries/   Our models have now changed and a new model has been added to e-lo. In RawText, we store the input, in BlobText we store the functions from TextBlob lib. If we remove the instance from the first table, we also need to remove it from the second. Ref on_delete = models.CASCADE Lets add […]

Django database API migrations and models 101

Django API Once you’ve created your data models, Django automatically gives you a database-abstraction API that lets you create, retrieve, update and delete objects. This document explains how to use this API. Refer to the data model reference for full details of all the various model lookup options. https://docs.djangoproject.com/en/2.0/topics/db/queries/ So our testmodel is a simple […]