This demo web application is proof-of-concept for WeMove, a nonprofit focused on community-based campaigns and action for social change. It demonstrates Flask, SQL and Tailwind capabilities.
- Campaign Management: Users can create and report campaigns.
- User Management: User registration and profile management features.
- Donation System: Report donations from users to campaigns.
- Backend: Built with Python and Flask.
- Database: SQL Lite is used to store and manage data. All SQL queries will be written directly without the use of an ORM. All SQL queries are stored in
database/queries
files and are imported as needed. - Frontend: HTML, CSS / Tailwind, Jinja templating engine.
- Tailwind CSS: Sourced from a CDN, and is not installed locally for this project.
- Blueprints: Organized into three main blueprints:
- Campaign: Handles the campaign logic.
- User: Manages user accounts and profiles.
- Donation: Manages donation-related activities.
This project is a proof-of-concept to demonstrate a Flask-based application that allows management of campaigns, donations, and user interactions.
To get started with the application, clone the repository to your local machine using the following command:
git clone https://github.com/mattburnett-repo/we-move.git
cd we-move
Part of the application (the flash messaging system) requires a secret key value.
The key can be anything. Here's a command to generate a key (assuming you have Python on your machine):
python -c "import secrets; print(secrets.token_hex(16))"
Copy the .env.sample
file in the project root to .env
cp .env.sample .env
Add the key you just created to the FLASK_SECRET_KEY=
entry in the .env
file:
FLASK_SECRET_KEY=your.secret.key
Once the repository has been cloned and the key is generated / saved, you can start the app by using the provided Docker containment.
At the project root, run
docker compose up --build
This will build and start the app. Once the build and start are finished, you should be able to see the app at
http://localhost:5000 or http://127.0.0.1:5000
If you don't want to use Docker, the following steps should get you started:
-
Create a Virtual Environment
It's recommended to use a virtual environment for managing dependencies. Run the following commands to create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use venv\Scripts\activate
-
Create Secret Key
Make sure you created the key as described the previous section, above.
-
Install Python Dependencies
Install the necessary Python dependencies by running:
pip install -r requirements.txt
-
Set Up the Database
This demo app ships with a SQLite3 database (we-move.sqlite), located in the
instances
folder. It contains some sample data to get you started.However, you can create a new database, set up the necessary tables, and populate the database with sample data. This is useful if you have been working with the app and want to start the database over fresh. Run
flask init-db
in a terminal.init-db
is a Click command that creates the database and populates the tables with sample data.(venv) flask init-db
-
Start the Flask Application
To start the Flask application, use the following command:
(venv)
flask run
This will start the development server at
http://127.0.0.1:5000/
.
- A more robust deployment process would benefit from tests.
- Not sure of the best way to isolate/test API, since it's closely bound to templates.
- Playwright, or something similar, for UI tests.
- AJAX for frontend interaction with the API.
This project is licensed under the MIT License.