{"id":18930652,"url":"https://github.com/tecladocode/simple-flask-template-app","last_synced_at":"2025-06-25T15:03:22.960Z","repository":{"id":53658543,"uuid":"195256410","full_name":"tecladocode/simple-flask-template-app","owner":"tecladocode","description":"A simple Flask app that uses render_template, to teach different features of Flask.","archived":false,"fork":false,"pushed_at":"2023-02-02T06:34:35.000Z","size":15,"stargazers_count":10,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T12:39:03.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tecladocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T14:27:41.000Z","updated_at":"2025-01-15T15:59:12.000Z","dependencies_parsed_at":"2023-02-17T15:30:48.654Z","dependency_job_id":null,"html_url":"https://github.com/tecladocode/simple-flask-template-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tecladocode%2Fsimple-flask-template-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tecladocode%2Fsimple-flask-template-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tecladocode%2Fsimple-flask-template-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tecladocode%2Fsimple-flask-template-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tecladocode","download_url":"https://codeload.github.com/tecladocode/simple-flask-template-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239927817,"owners_count":19719835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:38:24.025Z","updated_at":"2025-02-20T22:44:31.194Z","avatar_url":"https://github.com/tecladocode.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Flask Template App\n\nThis short code repository shows how a Flask application that serves HTML files may be created.\n\nIt is used in our blog post, \"How to add user logins to your Flask website\". Read that for more info!\n\n## Installing\n\nYou'll need `flask` to run this code sample. Install it like so:\n\n```\npipenv install flask\n```\n\n## The app\n\nCreating a Flask app is simple. Here we create one and also give it a `secret_key`. This is used for securing the cookies that the Flask app sends to each user.\n\n```python\nfrom flask import Flask, render_template, session\n\napp = Flask(__name__)\napp.secret_key = \"jose\"\n```\n\n## The users\n\nIn this Flask application we have a list of users. We use these to implement authentication (login and signup) in the app. We do that in the blog post.\n\n```python\nusers = {\"jose\": (\"jose\", \"1234\")}\n```\n\nThis is a mapping of usernames to user data. This allows us to access `users[username]` when a user sends us their username.\n\nIt means we won't have to search through a list of users when we get a user's username.\n\n## The routes\n\nWe have three pages in this starter app: `home`, `login`, and `register`.\n\nAt the moment these only return HTML pages (from the `templates` folder). In the blog post we modify two of them to actually deal with user data.\n\n```python\n@app.route(\"/\")\ndef home():\n    return render_template(\"home.jinja2\")\n\n\n@app.route(\"/login\")\ndef login():\n    # Here you could deal with the user's username and password.\n    # Check if they're correct.\n    return render_template(\"login.jinja2\")\n\n\n@app.route(\"/register\")\ndef register():\n    # Here you could register the user.\n    # Add them to a database, for example.\n    return render_template(\"register.jinja2\")\n```\n\n## Running the app\n\nTo run this app, enter the Pipenv shell and run the app via the Flask CLI. Make sure you're in the correct directory first:\n\n```\npipenv shell\nflask run\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftecladocode%2Fsimple-flask-template-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftecladocode%2Fsimple-flask-template-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftecladocode%2Fsimple-flask-template-app/lists"}