This is a Flask-based CRUD (Create, Read, Update, Delete) application for managing job offerings at a company called Jovian. The application connects to a MySQL database hosted on Aiven and provides functionalities to view job listings, apply for jobs, and manage applications. Additionally, it integrates hCaptcha for form validation and sends email notifications upon successful job applications.
- Job Listings: View all available job positions at Jovian.
- Job Application: Apply for a specific job position.
- Admin Features: View and manage job applications.
- Email Notifications: Sends a confirmation email to the applicant upon successful application submission.
- hCaptcha Integration: Adds an extra layer of security by validating user interactions.
- Python 3.7+
- MySQL database
- Flask
- hCaptcha account
-
Clone the repository
git clone -b master https://github.com/aayushsiwa/jovian cd jovian
-
Create a virtual environment and activate it
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables Create a
.env
file in the project root directory and add the following environment variables:DB_SECRET=your_database_connection_string SMTP_USER=your_smtp_username SMTP_PASS=your_smtp_password MAIL_FROM=your_email_address CAPTCHA_SITEKEY=your_hcaptcha_site_key CAPTCHA_SECRET=your_hcaptcha_secret_key
-
Run the application
flask --app index run
index.py
: The main Flask application file.templates/
: Directory containing HTML templates.static/
: Directory containing static files like CSS, JavaScript, and images.requirements.txt
: Python dependencies..env
: File containing environment variables.
Responsible for sending email notifications.
def send_email(receiver_email, subject, message):
# Email sending logic
Functions to load and manage jobs and applications from the database.
def load_jobs():
# Fetch all job listings
def load_job(id):
# Fetch a specific job by ID
def application(jobId, data):
# Process a job application
def load_applications():
# Load all applications
def load_application(jobId):
# Load application for a specific job ID
/
: Home page displaying job listings./api/jobs
: API endpoint to list all jobs./api/jobs/<id>
: API endpoint to fetch a specific job by ID./api/applications
: API endpoint to list all applications./api/applications/<jobId>
: API endpoint to fetch applications for a specific job ID./job/<id>
: Web page to view a specific job./job/<id>/apply
: Web page to apply for a specific job (POST request).
Custom error handlers for different HTTP status codes.
@app.errorhandler(404)
def not_found_error(error):
# Handle 404 errors
@app.errorhandler(500)
def internal_server_error(error):
# Handle 500 errors
@app.errorhandler(400)
def bad_request_error(error):
# Handle 400 errors
@app.errorhandler(405)
def method_not_allowed(error):
# Handle 405 errors
- Viewing Jobs: Navigate to the home page to see all job listings.
- Applying for a Job: Click on a job to view details and apply.
- Managing Applications: Admins can view all applications through the provided API endpoints.
- hCaptcha: Used to prevent spam and abuse on the application form.
- Email Verification: Sends a confirmation email to verify the application submission.
- Ensure all environment variables are correctly set in the
.env
file. - Check database connectivity and credentials.
- Verify SMTP settings for email notifications.
- Use
flask run
withdebug=True
during development to see detailed error messages.
Feel free to open issues or submit pull requests for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.
By following this README, you should be able to set up and run the Jovian Job Offerings CRUD application locally. For any issues, refer to the troubleshooting section or open an issue on the project's GitHub repository.