Difference between revisions of "Python"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Django)
(37 intermediate revisions by the same user not shown)
Line 25: Line 25:
 
[[Exception Handling - Python]]
 
[[Exception Handling - Python]]
  
=GUIs In Python With Tkinter (WIP) ''- LizQ''=
+
=GUI With Tkinter (WIP) ''- LizQ''=
  
 
[[What Is Tkinter?]]
 
[[What Is Tkinter?]]
Line 33: Line 33:
 
[[Widgets - Tkinter]]
 
[[Widgets - Tkinter]]
  
=sqlite databases=
+
=GUI - Other options=
 +
 
 +
[[Creating A DIY Interface]]
 +
 
 +
[[PGU Interface]]
 +
 
 +
[[wxPython Interface]]
 +
 
 +
[[pyglet Interface]]
 +
 
 +
=SQLite Databases=
 
[[Create sqlite connection]]
 
[[Create sqlite connection]]
  
Line 47: Line 57:
 
[[Creating a virtual environment in Visual Studio]]
 
[[Creating a virtual environment in Visual Studio]]
  
[[Using pip to install into the virtual environment]]
+
=Web Apps=
 +
Web apps are cross platform apps which are used via a browser. This allows you to create a single app to cover platforms such has Windows, Linux, iOS, Android, and so on. These essentially have a server program, which when you start it will allow you to access your app via '''<nowiki>http://localhost:8000</nowiki>''' or '''<nowiki>http://127.0.0.1:8000</nowiki>'''. The exact port number may vary, but the server will output the correct link to use.
 +
 
 +
==Django==
 +
====Setup====
 +
[[Creating a Django Web App]]
 +
 
 +
[[Django management program]]
 +
 
 +
[[Django in PythonAnywhere]]
 +
 
 +
[[Creating the Home page in Django]]
 +
====Login System====
 +
[[Set up Login System in Django]]
 +
 
 +
[[Create a sign up page in Django]]
 +
 
 +
[[Create account edit page in Django]]
 +
 
 +
[[Enforce login required for page]]
 +
====Models in django====
 +
[[Creating a Model in Django]]
 +
 
 +
[[Display data from a model in django]]
 +
 
 +
[[Add data into a model in Django]]
 +
 
 +
[[Editing data into a model in Django]]
 +
 
 +
[[Delete data from a model in Django]]
 +
 
 +
[[Relating models in Django, ie Primary key to Foreign Key]]
 +
 
 +
[[Enforcing unique model entries]]
 +
 
 +
====Other skills====
 +
[[Passing an integer through the url to make a product page]]
 +
 
 +
[[Returning a 404 error if the value is not in the model data]]
 +
 
 +
[[Images in models and uploading images]]
 +
 
 +
[[Change password function]]
 +
 
 +
[[Reset password function]]
 +
 
 +
[[Fully OOP with generic views]]
  
=Web Apps=
 
 
==Flask==
 
==Flask==
 +
====Setup====
 
[[Creating a Flask Web App]]
 
[[Creating a Flask Web App]]
  
Line 57: Line 113:
 
[[Connecting MySQL to Flask Web App]]
 
[[Connecting MySQL to Flask Web App]]
  
==Django==
+
[[Connecting sqlite to Flask Web App]]
[[Creating a Django Web App]]
+
====Login System====
 +
[[Login and Logout in a Flask App]]
 +
 
 +
[[Register and Edit profile in a Flask App]]
 +
====Database / Models====
 +
Models aren't used in Flask, so you will need to use the normal SQLITE queries. Remember the previous tutorials create a class to handle the database, so you will need to write the SQL only. The execute command can be used for Create, Update, Insert, and Delete queries. The select command can be used to run a select query.
 +
 
 +
====Skills====
 +
[[Flashing messages in Flask App]]
 +
 
 +
[[Passing an integer via URL in Flask App]]
  
[[Convert from Django 1.11 to 2.2]]
+
[[Uploading files in Flask]]
  
[[Set up Login System in Django]]
+
[[Fully OOP views in Flask]]

Revision as of 11:44, 18 November 2020

Skills

HelloWorld - Python

User Input - Python

Variables - Python

Conversions - Python

Maths Functions - Python

Selection - Python

Iteration - Python

String Manipulation - Python

Subroutines - Python

Global & Parameter Passing - Python

File Handling - Python

Exception Handling - Python

GUI With Tkinter (WIP) - LizQ

What Is Tkinter?

Creating a Window - Tkinter

Widgets - Tkinter

GUI - Other options

Creating A DIY Interface

PGU Interface

wxPython Interface

pyglet Interface

SQLite Databases

Create sqlite connection

Create table with sqlite

Insert Update Delete sqlite queries

Select sqlite queries

Using Visual Studio

Create a python project in Visual Studio

Creating a virtual environment in Visual Studio

Web Apps

Web apps are cross platform apps which are used via a browser. This allows you to create a single app to cover platforms such has Windows, Linux, iOS, Android, and so on. These essentially have a server program, which when you start it will allow you to access your app via http://localhost:8000 or http://127.0.0.1:8000. The exact port number may vary, but the server will output the correct link to use.

Django

Setup

Creating a Django Web App

Django management program

Django in PythonAnywhere

Creating the Home page in Django

Login System

Set up Login System in Django

Create a sign up page in Django

Create account edit page in Django

Enforce login required for page

Models in django

Creating a Model in Django

Display data from a model in django

Add data into a model in Django

Editing data into a model in Django

Delete data from a model in Django

Relating models in Django, ie Primary key to Foreign Key

Enforcing unique model entries

Other skills

Passing an integer through the url to make a product page

Returning a 404 error if the value is not in the model data

Images in models and uploading images

Change password function

Reset password function

Fully OOP with generic views

Flask

Setup

Creating a Flask Web App

Parts of a Flask Web App

Connecting MySQL to Flask Web App

Connecting sqlite to Flask Web App

Login System

Login and Logout in a Flask App

Register and Edit profile in a Flask App

Database / Models

Models aren't used in Flask, so you will need to use the normal SQLITE queries. Remember the previous tutorials create a class to handle the database, so you will need to write the SQL only. The execute command can be used for Create, Update, Insert, and Delete queries. The select command can be used to run a select query.

Skills

Flashing messages in Flask App

Passing an integer via URL in Flask App

Uploading files in Flask

Fully OOP views in Flask