# DirectLX.dev Company website for DirectLX built with Flask, HTMX, and Tailwind CSS. ## Tech Stack - **Backend**: Python Flask with Flask-SQLAlchemy - **Database**: SQLite - **Frontend**: HTMX for dynamic interactions, Tailwind CSS for styling - **Templating**: Jinja2 - **Production**: Gunicorn + Nginx ## Features - Company pages (Home, About, Services, Contact) - Blog with search and pagination - Community forum with categories, topics, and replies - HTMX-powered forms and dynamic content loading - Responsive design ## Project Structure ``` directlx.dev/ ├── app.py # Flask application & routes ├── config.py # Configuration settings ├── models.py # SQLAlchemy models ├── wsgi.py # WSGI entry point ├── requirements.txt # Python dependencies ├── package.json # Node dependencies (Tailwind) ├── tailwind.config.js # Tailwind configuration ├── templates/ │ ├── base.html # Base layout │ ├── index.html # Home page │ ├── about.html # About page │ ├── services.html # Services page │ ├── contact.html # Contact page │ ├── blog/ # Blog templates │ └── forum/ # Forum templates ├── static/ │ ├── css/ │ │ ├── input.css # Tailwind source │ │ └── styles.css # Compiled CSS │ ├── js/ │ │ └── htmx.min.js # HTMX library │ └── images/ │ └── directLX_small.png ├── instance/ │ └── directlx.db # SQLite database ├── nginx.conf # Nginx configuration ├── directlx.service # Systemd service └── deploy.sh # Deployment script ``` ## Local Development ### Prerequisites - Python 3.10+ - Node.js (for Tailwind CSS) ### Setup ```bash # Clone and enter directory cd directlx.dev # Create Python virtual environment python3 -m venv venv source venv/bin/activate # Install Python dependencies pip install -r requirements.txt # Install Node dependencies and build CSS npm install npm run build:css # Run development server python app.py ``` Open http://localhost:5000 ### Tailwind CSS Watch for changes during development: ```bash npm run watch:css ``` Rebuild CSS after template changes: ```bash npm run build:css ``` ## Production Deployment ### Automated Deployment ```bash sudo ./deploy.sh ``` ### Manual Deployment 1. **Copy files to server:** ```bash sudo mkdir -p /var/www/html/directlx.dev sudo cp -r app.py config.py models.py wsgi.py requirements.txt templates static /var/www/html/directlx.dev/ ``` 2. **Set up Python environment:** ```bash cd /var/www/html/directlx.dev sudo python3 -m venv venv sudo venv/bin/pip install -r requirements.txt ``` 3. **Create environment file:** ```bash echo "SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))')" | sudo tee .env ``` 4. **Set permissions:** ```bash sudo chown -R www-data:www-data /var/www/html/directlx.dev sudo chmod -R 755 /var/www/html/directlx.dev ``` 5. **Install systemd service:** ```bash sudo cp directlx.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now directlx ``` 6. **Configure Nginx:** ```bash sudo cp nginx.conf /etc/nginx/sites-available/directlx.dev sudo ln -sf /etc/nginx/sites-available/directlx.dev /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx ``` ### Useful Commands ```bash # Check application status sudo systemctl status directlx # View application logs sudo journalctl -u directlx -f # Restart application sudo systemctl restart directlx # Reload Nginx sudo systemctl reload nginx ``` ## Environment Variables | Variable | Description | Required | |----------|-------------|----------| | `SECRET_KEY` | Flask secret key for sessions | Yes (production) | | `DATABASE_URL` | Database connection string | No (defaults to SQLite) | ## Database Models - **User** - User accounts with authentication - **BlogPost** - Blog articles with slugs - **ForumCategory** - Forum category organization - **ForumTopic** - Discussion topics - **ForumReply** - Topic replies - **ContactMessage** - Contact form submissions ## API Routes | Route | Description | |-------|-------------| | `/` | Home page | | `/about` | About page | | `/services` | Services page | | `/contact` | Contact page | | `/blog` | Blog listing | | `/blog/` | Single blog post | | `/forum` | Forum categories | | `/forum/` | Category topics | | `/forum//` | Topic with replies | ## License All rights reserved.