Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate FastAPI with Website, Restructure Project, and Enhance Compatibility #386

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Rucha-Ambaliya
Copy link
Contributor

Related Issue

Partially Fixes #374

Description

This pull request focuses on integrating FastAPI with the existing website, restructuring the project for better maintainability, and ensuring seamless compatibility with MongoDB. The updates also include improved documentation and dependency management.

Key Updates

1. Dependency Management

  • Installed all required dependencies for the project.
  • Updated requirements.txt to include the latest dependencies, ensuring the project runs smoothly.

2. Enhanced Project Structure

  • Restructured the project directories and files to improve clarity and maintainability.
  • Updated PROJECT_STRUCTURE.md to reflect the new organization.

3. FastAPI Integration

  • Added routes in main.py in website folder to serve all HTML pages dynamically:
    @app.get("/", response_class=HTMLResponse)
    def read_root(request: Request):
        return templates.TemplateResponse("index.html", {"request": request})
    @app.get("/login", response_class=HTMLResponse)
     def documentation(request: Request):
      return templates.TemplateResponse("login.html", {"request": request})
    # other
    

4. Static File Routing:

  • Staged routes for static files for use across the website:
    app.mount("/static", StaticFiles(directory="../"), name="static")
    app.mount("/web_images", StaticFiles(directory="web_images"), name="web_images")
    app.mount("/styles", StaticFiles(directory="styles"), name="styles")
    app.mount("/scripts", StaticFiles(directory="scripts"), name="scripts")
    app.mount("/software", StaticFiles(directory="../software"), name="software")
    app.mount("/Documentation", StaticFiles(directory="../Documentation"), name="Documentation")

5. MongoDB Integration:

  • Successfully connected the application to MongoDB.
  • Tested the connection to ensure functionality.

6. Secure Environment Management:

  • Implemented .env file support to securely manage sensitive configurations like database URLs.

7. Documentation Improvements:

  • Updated README.md to include steps for running the website using FastAPI.

Testing

  • Verified that all static files and routes work as expected.
  • Confirmed MongoDB connection functionality.

Screenshots

Live website:

Recording.2025-01-17.202140.1.mp4

main.py in website

Recording.2025-01-17.233425.mp4

README.md

Screenshot 2025-01-17 231928

PROJECT_STRUCTURE.md

Screenshot 2025-01-17 232056

Please review the changes and share your feedback. If any additional enhancements or modifications are needed, let me know!

Type of change

  • New feature

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

Copy link
Contributor

🎉 Thank you for your contribution! Your pull request has been submitted successfully. A maintainer from team will review it soon. We appreciate your support in making better.

Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for multiverse-dataverse ready!

Name Link
🔨 Latest commit 243a3d7
🔍 Latest deploy log https://app.netlify.com/sites/multiverse-dataverse/deploys/678a9c405c3dee000839c426
😎 Deploy Preview https://deploy-preview-386--multiverse-dataverse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WEBSITE] Create backend to store feedbacks
1 participant