This is a simple web application that allows users to register, log in, create posts about coffee they have had, view all posts by themselves and others, and log out. The application is built using Flask, a Python web framework, and incorporates user authentication and post management features.
-
User Registration:
- Users can register for an account by providing a unique username, email, and password.
- Registration ensures that usernames and emails are unique to each user.
-
User Login:
- Registered users can log in using their credentials.
- The application securely manages user sessions.
-
Post Creation:
- Authenticated users can create posts by entering text content.
- Each post is associated with the user who created it.
-
Viewing Posts:
- Users can view a feed of posts, displaying the most recent posts at the top.
- The posts include the username of the creator, the post content, and the timestamp of creation.
-
User Logout:
- Authenticated users can log out to end their session securely.
- Flask: A lightweight and flexible web framework for Python.
- Flask-Bcrypt: A Flask extension that provides Bcrypt hashing utilities for password hashing.
- SQLAlchemy: ORM (Object-Relational Mapping) library for working with databases.
- MySQL on AWS RDS: The application uses MySQL as the database hosted on Amazon RDS.
- HTML AND CSS: Basic webpage markup languages
-
Install Python and create a virtual environment:
python -m venv venv
or
py -3 -m venv venv
-
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\activate
-
On Unix or MacOS:
source venv/bin/activate
-
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a 'config.py' file that will contain your app secret key, db credentials and any other secret the app uses. Be sure to create the database and all necessary credentials prior and test connectivity. Schema is defined in the schema.sql file.
-
Run the application:
-
On the terminal
flask run
-
As a containerized application
-
At the root directory , there is a Dockerfile. Run the command below in the root directory (where app.py, Dockerfile and requirements.txt are)
docker build -t virtual-coffeeshop .
-
Once image has been built successfully, you can start a container interactively or detached using either of the commands below respectively.
docker run --name virtual-coffee -p 5000:5000 virtual-coffeeshop
or
docker run -d --name virtual-coffee -p 5000:5000 virtual-coffeeshop
-
The application will be accessible at
http://127.0.0.1:5000/
in your web browser.
-
Open the application in your web browser.
-
Register for a new account using a unique username and email.
-
Log in using your registered credentials.
-
Create a new post by entering text content.
-
View posts on the main feed, including your own posts and those of other users.
-
Log out when you are done.
Feel free to contribute to the project by submitting bug reports, feature requests, or pull requests. Your feedback and contributions are welcome!
This project is licensed under the MIT License.