A todo app using FastAPI.
- Installation
- Setting Up the Environment
- Running the Application
- Fix for Passlib Bcrypt Error Warning
- Data Migration with Alembic
- API Endpoints
- Python 3.9 or higher
- Pipenv
- PostgreSQL (or any other supported database)
- Clone the repository:
git clone https://github.com/your-username/todo_app.git
cd todo_app- Create a virtual environment and install dependencies
pipenv install
- Activate the virtual environment:
pipenv shell
- Set up environment variables: Create a .env file in the project root and add the necessary environment variables. For example:
DATABASE_URL=postgresql://user:password@localhost/todo_app
SECRET_KEY=your_secret_key
- Start the FastAPI server:
uvicorn auth.user:app --reload
The application will be available at http://127.0.0.1:8000.
version = _bcrypt.__about__.__version__
In the .venv/Lib/site-packages/passlib/handlers/bcrypt.py file, change the line:
version = _bcrypt.__about__.__version__
to:
version = _bcrypt.__version__
To generate a requirements.txt file from Pipenv, run:
pipenv lock -r > requirements.txt
Alembic is a powerful tool that allows us to modify database schemas.
Alembic Installation
pip install alembic
- Initialize Alembic:
alembic init alembic
This prepares and creates necessary files for database migrations.
- Create a new migration:
alembic revision -m "create user phone number col"
This creates a new file to modify the database.
- Run the migration:
alembic upgrade <revision_number>
This runs the migration specific file using the revision number.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.