Skip to content

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask SQLite Example

This is a simple Flask app that demonstrates how to create a web application with SQLite database integration. The app allows users to add their first name and last name, which gets stored in an SQLite database.

Prerequisites

  • Python 3.x installed on your machine.
  • Git installed.
  • Docker installed.

Setup

  1. Clone the repository:

    git clone https://github.com/your-username/flask-sqlite-example.git
  2. Navigate to the project directory:

    cd flask-sqlite-example

Run the Flask App Locally

  1. (Optional) Create a virtual environment:

    python -m venv venv

    Activate the virtual environment:

    • On Windows:

      .\venv\Scripts\activate
    • On macOS/Linux:

      source venv/bin/activate
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Run the Flask app:

    python app.py

    The app will be accessible at http://127.0.0.1:5000/ in your web browser.

Create a Docker Image

  1. Create a Docker image:

    docker build -t flask-sqlite-example .
  2. Run the Docker container:

    docker run -p 5000:5000 flask-sqlite-example

    The app will be accessible at http://127.0.0.1:5000/ in your web browser.

View SQLite Database

  1. (Optional) Install DB Browser for SQLite.

  2. Open database.db in the src directory using DB Browser for SQLite to visualize the data.

Project Structure

  • src: Contains the Flask application code.
    • __pycache__: Auto-generated directory for Python bytecode.
  • static: Contains static files (CSS, images, scripts).
    • images: Place for your images.
    • scripts: JavaScript files.
    • style: CSS files.
  • templates: HTML templates for the Flask app.

Feel free to explore and modify the code to understand how the Flask app works. If you have any questions or run into issues, don't hesitate to ask.

Happy coding!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages