This is a simple Flask application that connects to a MongoDB Atlas cluster and allows users to submit their information through a form. The submitted data is then stored in the MongoDB database.
- User can submit their name, email, and password through a form.
- The data is stored in a MongoDB database.
Before you begin, ensure you have met the following requirements:
- Python 3.x installed on your local machine.
- MongoDB Atlas account with a cluster and database set up.
- Internet connection to connect to the MongoDB Atlas cluster.
- Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the required packages:
pip install -r requirements.txt
- Set up the environment variable for MongoDB URI:
export MONGODB_URI="mongodb+srv://yourusername:yourpassword@cluster0.mongodb.net/?retryWrites=true&w=majority&appName=yourAppName"
On Windows, use:
set MONGODB_URI="mongodb+srv://yourusername:yourpassword@cluster0.mongodb.net/?retryWrites=true&w=majority&appName=yourAppName"
To run the application, execute the following command:
python mongo.py
The application will be accessible at http://localhost:5000
.
.
├── static
│ └── styles.css # Your static files (CSS, JS, images)
├── templates
│ ├── index.html # The form for user input
│ └── response.html # The response page after form submission
├── mongo.py # The main application file
├── test.py # The MongoDB connection test file
├── requirements.txt # Python dependencies
└── README.md # This file
- Navigate to
http://localhost:5000
. - Fill out the form with your name, email, and password.
- Click the submit button.
- If all fields are filled out correctly, you will be redirected to the response page.
To contribute to this project, please follow these steps:
- Fork this repository.
- Create a new branch:
git checkout -b feature/your-feature-name
. - Make your changes and commit them:
git commit -m 'Add some feature'
. - Push to the original branch:
git push origin feature/your-feature-name
. - Create a pull request.
This project is open source and available under the MIT License.
If you want to contact me, you can reach me at achanandhi.m@gmail.com.
### Instructions
1. **Replace placeholders** such as `yourusername`, `your-repo-name`, `yourpassword`, `yourAppName`, and `your-email@example.com` with your actual information.
2. **Create a `requirements.txt` file** by running `pip freeze > requirements.txt` in your virtual environment.
3. **Push to GitHub**:
```sh
git add .
git commit -m "Initial commit"
git push origin main