A lightweight, high-performance Python web framework built from scratch with modern features and clean architecture.
- High Performance: Multi-threaded HTTP server with connection pooling
- File Upload Support: Built-in multipart file upload handling
- Route Mapping: Flexible routing system with parameter support
- View Engine: Template rendering system
- Configuration Management: JSON-based configuration
- Cookie Support: Built-in cookie handling
- Static Assets: Automatic static file serving
- Middleware Support: Extensible middleware architecture
- Python 3.6+
- No external dependencies (pure Python implementation)
Clone the repository:
git clone https://github.com/realcyberdyne/GenaPyFramework.gitNavigate to the project directory:
cd GenaPyFrameworkRun the application:
python app.pyThe server will start on localhost:9009 by default.
GenaPyFramework/
├── app.py # Main application entry point
├── config.json # Configuration file
├── Assets/ # Static assets (CSS, images)
├── Config/ # Configuration management
├── Controllers/ # MVC Controllers
├── Http/ # HTTP handling
│ ├── Handlers/ # Request/Response handlers
│ └── Middleware/ # Middleware components
├── Reponse/ # Response utilities
├── Route/ # Routing system
├── View/ # HTML templates
├── FileManager/ # File management utilities
├── Files/ # File storage
└── FileTmp/ # Temporary file uploads
Edit config.json to customize your application:
{
"app": {
"PORT": 9009,
"HOST": "localhost",
"BUFFERSIZE": 99999,
"RequestTimeOut": 0.5,
"MAX_FILE_SIZE": 10,
"UPLOAD_DIR": "C:\\Users\\rezafta\\Desktop\\GenaPyFramework\\FileTmp"
}
}PORT: Server port numberHOST: Server host addressBUFFERSIZE: Request buffer size in bytesRequestTimeOut: Request timeout in secondsMAX_FILE_SIZE: Maximum file upload size in MBUPLOAD_DIR: Directory for file uploads
from Reponse.DResponse import DResponse
from Reponse.DView import DView
class HomeController:
def index(self, params, request):
return DResponse(DView("index"))
def sayhello(self, request, params):
return DResponse("Hello %s!" % params["name"])Routes are defined in Route/GetMapping.py:
routes = [
{
'pattern': '/',
'controller': HomeController,
'method': 'index'
},
{
'pattern': '/hello/{name}',
'controller': HomeController,
'method': 'sayhello'
}
]The framework automatically handles multipart file uploads. Uploaded files are saved to the configured UPLOAD_DIR.
Static files in the Assets/ directory are automatically served at /Assets/ URLs.
- Create a controller method in
Controllers/ - Add the route pattern in
Route/GetMapping.py - Map the route to your controller method
- Add HTML templates to the
View/directory - Use
DView("template_name")in your controller - Templates are automatically rendered
Add custom middleware in Http/Middleware/ to extend functionality.
GET /- Home pageGET /sampleform- Sample form pageGET /Assets/*- Static assets
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
For support and questions, please open an issue on GitHub.
Powered by Cyberdyne 🚀