Raahaao Code: Flask
Flask ਨਾਲ ਅਸਲ Python ਵੈੱਬਸਾਈਟਾਂ ਅਤੇ API ਬਣਾਓ।
9+ ਪਾਠ ਦੇ ਘੰਟੇ · 2 ਪ੍ਰੋਜੈਕਟ · €35
ਇਹਨਾਂ ਪ੍ਰੀਖਿਆਵਾਂ ਦੀ ਤਿਆਰੀ ਵਿੱਚ ਮਦਦ ਕਰਦਾ ਹੈ: PCAP – Certified Associate Python Programmer (Python Institute)
ਜਾਂ ਇਸਨੂੰ ਮਹੀਨਾਵਾਰ ਪਲਾਨ ਵਿੱਚ ਲਓ, €3.46 ਪ੍ਰਤੀ ਹਫ਼ਤੇ ਤੋਂ (ਬਿੱਲ ਹਰ ਮਹੀਨੇ €15) →
ਕੋਈ ਵੀ ਪਾਠ ਖੋਲ੍ਹਣ ਲਈ ਖਾਤਾ ਚਾਹੀਦਾ ਹੈ। ਖਾਤੇ ਬਿਨਾਂ ਤੁਸੀਂ ਮੰਜ਼ਿਲਾਂ ਅਤੇ ਕੀਮਤਾਂ ਵੇਖ ਸਕਦੇ ਹੋ।
ਤੁਸੀਂ ਸਿੱਖੋਗੇ, ਮੰਜਿਲ ਦਰ ਮੰਜਿਲ
- 1
First app (Beginner)
- How a web framework works
- Routes and views
- Templates with Jinja
- 2
Forms & data (Beginner)
- Request data
- Validation and flash messages
- Static files and layout
- 3
Storage (Intermediate)
- SQLite from Flask
- CRUD pages
- Blueprints and app factories
- 4
Users (Intermediate)
- Sessions and cookies
- Logins with hashed passwords
- Authorisation: roles and ownership
- 5
Pro (Job-ready)
- JSON APIs
- Security essentials
- Testing a Flask app
- Deploying Flask
ਛੱਤ ਉੱਤੇ ਦੋ ਪ੍ਰੋਜੈਕਟ
Link-in-bio builder
Build a small Flask service where people can register, sign in, and maintain a public profile with useful links. The app uses SQLite for accounts and profile data, a signed session to remember the current user, and password hashes instead of readable passwords.
- create_app(test_config=None) returns a configured Flask application and accepts per-app configuration, including DATABASE and SECRET_KEY
- POST /register accepts JSON username and password, creates a user and empty profile, returns {"username": username} with 201, returns 400 for invalid input, and 409 for a duplicate username
- POST /login verifies a username and password, returns {"username": username} with 200 and stores the user id in the session; invalid credentials return {"error": "Invalid username or password"} with 401; POST /logout clears the session and returns {"message": "Logged out"} with 200; passwords are stored as Werkzeug hashes
- PUT /api/me requires login and accepts JSON display_name, bio, and links; display_name must be 1–80 characters, bio at most 160 characters, and links a list of at most 5 absolute http or https URLs; valid data is saved and returned with 200, invalid data returns a JSON error with 400, and anonymous requests return 401
- GET /u/<username> returns an HTML public profile page with display name, bio, and links; user-provided text is HTML-escaped and an unknown username returns {"error": "Profile not found"} with 404
- Profile edits are limited to the authenticated owner; unauthenticated edit requests return {"error": "Login required"} with 401
- GET /api/u/<username> returns {"username": username, "display_name": display_name, "bio": bio, "links": links} with 200, or {"error": "Profile not found"} with 404
Class booking system
Build a Flask app for a small class studio, where customers can book a place and cancel their own booking. An admin can create classes with a time and capacity, and clients can inspect the schedule through a JSON API.
- create_app(config=None) returns a fresh Flask application and applies configuration overrides.
- The app stores classes and bookings in SQLite, using parameterized SQL and the configured DATABASE path.
- Only a session with role "admin" can create a class.
- GET /api/classes returns 200 JSON with the shape {"classes": [...]} and each class has id, name, starts_at, capacity, and booked.
- A customer can book an available class with POST /api/classes/<int:class_id>/book, receiving 201 JSON {"booking_id": id, "class_id": class_id}.
- A customer cannot book the same class twice; the repeated request returns 409 JSON {"error": "already booked"}.
- A class cannot be overbooked; a booking when it is full returns 409 JSON {"error": "class is full"}.
- A customer can cancel their own booking with DELETE /api/bookings/<int:booking_id>, receiving 200 JSON {"cancelled": true}.
- A customer cannot cancel another customer’s booking; the response is 404 JSON {"error": "booking not found"}.
- Booking a class that does not exist returns 404 JSON {"error": "class not found"}.
- Invalid class input returns 400 JSON {"error": "name and starts_at are required; capacity must be a positive integer"}.
- Unauthenticated booking requests return 401 JSON {"error": "login required"}; non-admin class creation returns 403 JSON {"error": "admin required"}.
- The learner writes at least five test_ functions in app.py and runs each one with Flask’s test client.
ਸਵਾਲ
ਮੈਨੂੰ ਕੁਝ ਇੰਸਟਾਲ ਕਰਨਾ ਪਵੇਗਾ?
ਨਹੀਂ। ਸਭ ਕੁਝ ਤੁਹਾਡੇ ਬ੍ਰਾਊਜ਼ਰ ਵਿੱਚ ਚਲਦਾ ਹੈ। ਪ੍ਰੋਜੈਕਟਾਂ ਲਈ ਤੁਸੀਂ ਆਪਣੇ ਕੰਪਿਊਟਰ ਉੱਤੇ ਵੀ ਕੰਮ ਕਰ ਸਕਦੇ ਹੋ ਅਤੇ ਆਪਣੀਆਂ ਫਾਈਲਾਂ ਅੱਪਲੋਡ ਕਰ ਸਕਦੇ ਹੋ।
ਕੀ ਮੈਂ ਉਹ ਨੱਕ ਸਕਦਾ ਹਾਂ ਜੋ ਮੈਂ ਪਹਿਲਾਂ ਸੇ ਜਾਣਦਾ ਹਾਂ?
ਹਾਂ। ਜਦੋਂ ਤੁਸੀਂ ਕਿਸੇ ਮੰਜਿਲ ਦੇ ਮਾਲਕ ਬਣ ਜਾਉ, ਹਰੇਕ ਮੰਡਲੀ ਦੀ ਇੱਕ ਪਰੀਖਿਆ ਹੈ: 10 ਵਿੱਚੋਂ 8 ਸਕੋਰ ਕਰੋ ਅਤੇ ਉਹ ਮੰਜਿਲ ਖੁੱਲ ਜਾਂਦੀ ਹੈ।
ਵਾਪਸੀ ਨੀਤੀ ਕੀ ਹੈ?
ਖਰੀਦ ਦੇ 5 ਦਿਨਾਂ ਅੰਦਰ ਵਾਪਸੀ। 5 ਦਿਨਾਂ ਦੇ ਬਾਅਦ, ਕੋਈ ਵਾਪਸੀ ਜਾਂ ਵਾਪਸ ਨਹੀਂ।
ਕੀ ਮੈਂ ਪਹੁੰਚ ਰੱਖਦਾ ਹਾਂ?
ਹਾਂ। ਜੋ ਮੰਜਿਲ ਤੁਸੀਂ ਖਰੀਦਦੇ ਹੋ ਉਹ ਤੁਹਾਡੀ ਹੈ, ਕੋਈ ਸਦਸਤਾ ਨਹੀਂ ਹੈ।
ਮੰਜਿਲਾਂ
HTML & CSS · JavaScript · Python · SQL · C++ · Node.js · ਡਾਟਾ ਲਈ ਪਾਇਥਨ · Logic & Problem Solving · Algorithms & Data Structures · Java · Machine Learning · Building with AI