GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - zaber-dev/MVC-Python: Flask-based web application following the MVC (Model-View-Controller) structure, with the added feature of integrating a Discord bot using Disnake. This setup allows you to build a web app while also having a Discord bot running in parallel, enabling additional functionality.

BranchesTags
Open more actions menu

Latest commit

 

History

25 Commits
25 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/ISSUE_TEMPLATE
.github/ISSUE_TEMPLATE
 
 
app
app
 
 
config
config
 
 
database
database
 
 
resources/views
resources/views
 
 
routes
routes
 
 
vendor
vendor
 
 
.env_example
.env_example
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

Flask MVC Structure with Discord Integration

Welcome to the Flask MVC Structure with Discord Integration! This project is primarily a Flask-based web application following the MVC (Model-View-Controller) structure, with the added feature of integrating a Discord bot using Disnake. This setup allows you to build a web app while also having a Discord bot running in parallel, enabling additional functionality. The structure is flexible, allowing you to expand it for more parallel tasks, or easily adjust it to run a single task as needed.

🚨 This is an Archived Project

This project has been archived and is no longer maintained. It represents an older version of the application.

āœ… New Version Available

A new and improved version of this project is available here: šŸ‘‰ Zeython

We recommend using the new version for the latest features, updates, and improvements.

Project Structure

.
ā”œā”€ā”€ app
│   ā”œā”€ā”€ Actions             # Utility functions (pagination, embeds, webhook handling, etc.)
│   ā”œā”€ā”€ Commands            # Discord command handling
│   │   ā”œā”€ā”€ Context         # Traditional Discord commands
│   │   └── Slash           # Slash commands for Discord
│   ā”œā”€ā”€ Controllers         # Controller logic for Flask and Discord
│   │   ā”œā”€ā”€ Flask           # Controllers specific to Flask web app
│   │   └── Discord         # Controllers for Discord bot
│   ā”œā”€ā”€ Models              # Data models for the application
│   └── Views               # Dynamic Flask views/templates structures
ā”œā”€ā”€ config
│   └── boot.py             # Main entry point to boot up the program (Flask + Discord)
ā”œā”€ā”€ database
│   └── db.py               # Database interactions (abstraction layer)
ā”œā”€ā”€ resources                # Static and template files for Flask
│   ā”œā”€ā”€ css                 # CSS files
│   ā”œā”€ā”€ js                  # JavaScript files
│   └── views               # HTML templates
ā”œā”€ā”€ routes
│   ā”œā”€ā”€ api.py              # Routes for API endpoints
│   └── web.py              # Routes for web pages
ā”œā”€ā”€ storage                  # User file storage (uploads, etc.)
ā”œā”€ā”€ vendor                   # Placeholder for third-party integrations (collaborations welcome)
ā”œā”€ā”€ requirements.txt         # Python dependencies
ā”œā”€ā”€ Dockerfile               # Docker containerization file
└── .env                     # Environment configuration variables

Features Implemented

Flask

  • MVC Structure: Organized codebase that follows the MVC pattern for better separation of concerns:
    • Models handle data.
    • Views are rendered by Flask, found in resources/views.
    • Controllers handle business logic for web and API routes.
  • Routing:
    • API routes are defined in routes/api.py.
    • Web routes are in routes/web.py.
  • Database Abstraction: Easy-to-extend database layer (database/db.py) for managing models.
  • Templates & Static Files: Resources such as HTML, CSS, and JavaScript are stored in resources/.

Discord Bot (Using Discord.py)

  • Commands:
    • Traditional text-based Discord commands in app/Commands/Context.
    • Slash commands in app/Commands/Slash.
  • Parallel Execution: The Discord bot runs alongside the Flask application for seamless interaction between web and Discord functionalities.
  • Utility Actions: Functions like pagination, embeds, and webhook handling in app/Actions.

Docker

  • Containerization: Provided Dockerfile allows you to run the entire application in a Docker container, simplifying the setup process.

What's Next?

To-Do

  • Vendor Integrations: Open for contributions to implement third-party integrations or plugins within the vendor/ directory.
  • Authentication: Integrate authentication (OAuth or token-based) for the web app and APIs.
  • File Management: Add advanced handling for user uploads within the storage/ folder.
  • Error Handling & Logging: Enhance error handling across both Flask and Discord components, with proper logging.

Collaboration

Contributions are welcome! If you'd like to collaborate, feel free to fork this repository and submit a pull request. Potential areas of contribution include:

  • Implementing additional Flask features.
  • Expanding Discord bot functionalities (commands, event listeners, etc.).
  • Integrating new third-party APIs or services.
  • Improving the MVC structures

Check out the issues section for current needs, or suggest your own enhancements!

Getting Started

  1. Clone the Repository:

    git clone https://github.com/MahediZaber51/MVC-Python.git
    cd MVC-Python
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Set up Environment Variables: Create a .env file in the root directory with the required environment variables for Flask and Discord (check the .env-example file).

  4. Run the Application:

    python config/boot.py
  5. Run in Docker:

    docker build -t flask-discord-app .
    docker run -d -p 5000:5000 flask-discord-app

License

This project is licensed under the GNU General Public License v3.0.

About

Flask-based web application following the MVC (Model-View-Controller) structure, with the added feature of integrating a Discord bot using Disnake. This setup allows you to build a web app while also having a Discord bot running in parallel, enabling additional functionality.

Topics

mvcmvc-architecturemvc-pythonpython-architecturepython3

Resources

Readme
GPL-3.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.