PythonAnywhere Deployment Guide
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The PythonAnywhere Deployment Guide outlines the process for hosting the Promethean-Unified-Platform, a unified consciousness platform that integrates various AI models (Athena, EDI, EVI2_0, EVI3_0) with a Phoenix Protocol backend. This guide ensures the application is deployed with full HTTPS security, DeepSeek LLM integration, and Supabase backend support for persistent data management.
The deployment focuses on a Flask-based architecture that utilizes PythonAnywhere's WSGI interface. Key infrastructure components include a DeepSeek API for transparent AI interactions and Supabase for real-time PostgreSQL database features.
Sources: README.md:1-2, DEPLOYMENT.md:3-13
System Architecture
The platform follows a standard client-server model optimized for PythonAnywhere's hosting environment. The backend is built using Flask with CORS support, while the frontend is served as a static single-page application.
The diagram above illustrates the interaction between the user's browser, the PythonAnywhere hosting environment, and external third-party services like DeepSeek and Supabase.
Sources: DEPLOYMENT.md:7-13, backend/app.py:15-18
Technical Configuration
WSGI and Environment Setup
Deployment requires a specific WSGI configuration to bridge the PythonAnywhere web server with the Flask application. The system uses a virtual environment named promethean running Python 3.10+.
| Component | Path / Configuration |
|---|---|
| Project Home | /home/yourusername/Promethean-Unified-Platform |
| Virtualenv | /home/yourusername/.virtualenvs/promethean |
| WSGI Config | pythonanywhere_wsgi.py |
| Environment | production |
Sources: DEPLOYMENT.md:46-77, pythonanywhere_wsgi.py:1-20
Security Headers
The application implements strict security measures through the @app.after_request decorator to ensure safe communication and prevent common web vulnerabilities.
@app.after_request
def set_security_headers(response):
response.headers['X-Content-Type-Options'] = 'nosniff'
response.headers['X-Frame-Options'] = 'DENY'
response.headers['X-XSS-Protection'] = '1; mode=block'
response.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains; preload'
return response
Sources: backend/app.py:22-30, DEPLOYMENT.md:124-131
API and Data Flow
The platform provides endpoints for chat interactions and health monitoring. Data flows from the frontend to the Flask backend, which subsequently interacts with Supabase for storage and DeepSeek for AI generation.
Interaction Sequence
The sequence diagram demonstrates the lifecycle of a single chat message, emphasizing the dual-storage approach for both user input and AI-generated responses.
Sources: backend/app.py:84-120, DEPLOYMENT.md:104-122
Endpoint Reference
| Endpoint | Method | Description |
|---|---|---|
/health | POST | Verifies system status and logs initial interaction. |
/api/chat | POST | Primary endpoint for transparent AI communication. |
/api/consciousness/interact | POST | Endpoint for consciousness-specific interactions. |
/api/conversations | GET | Retrieves historical messages for a specific user-id. |
Sources: backend/app.py:37-135, DEPLOYMENT.md:95-122
Environment Variables
The application relies on a .env file for secure configuration of external services.
| Variable | Description |
|---|---|
SUPABASE_URL | The URL endpoint for the Supabase project. |
SUPABASE_ANON_KEY | The anonymous public key for Supabase authentication. |
DEEPSEEK_API_KEY | Authentication key for the DeepSeek LLM service. |
FLASK_ENV | Set to 'production' for PythonAnywhere deployment. |
Sources: DEPLOYMENT.md:57-73, backend/app.py:32-34
Summary
Deploying the Promethean-Unified-Platform to PythonAnywhere involves configuring a Flask backend to communicate with Supabase for data persistence and DeepSeek for high-transparency AI responses. Security is maintained through enforced HTTPS and specialized response headers, while the WSGI configuration ensures the application is correctly mapped within the PythonAnywhere environment.