143 lines
No EOL
4.3 KiB
Markdown
143 lines
No EOL
4.3 KiB
Markdown
# PKMN Trade Club
|
||
|
||
PKMN Trade Club is a Django-powered application built to connect Pokémon TCG Pocket trading enthusiasts in a secure, scalable, and community-driven environment. This platform leverages Django’s robust features and stability, a modular project structure, and best practices to deliver a smooth trading experience.
|
||
|
||
## Table of Contents
|
||
|
||
- [PKMN Trade Club](#pkmn-trade-club)
|
||
- [Table of Contents](#table-of-contents)
|
||
- [Features](#features)
|
||
- [Installation](#installation)
|
||
- [Local Development](#local-development)
|
||
- [Docker Deployment](#docker-deployment)
|
||
- [Configuration](#configuration)
|
||
- [Database](#database)
|
||
- [Running Tests](#running-tests)
|
||
- [Deployment](#deployment)
|
||
- [Contributing](#contributing)
|
||
- [License](#license)
|
||
|
||
## Features
|
||
|
||
- **Django & Python**: Built with Django 5.1 and Python 3.12.
|
||
- **Modular Architecture**: Separate Django apps for trades, accounts, cards, and more.
|
||
- **User Authentication**: Comprehensive authentication powered by Django Allauth.
|
||
- **Responsive UI**: Custom theming with Tailwind CSS, DaisyUI, and AlpineJS.
|
||
- **Production-Ready**: Docker and PostgreSQL configuration for scalable deployments.
|
||
- **Development Tools**: Built-in support for migrations, testing, and seeding initial data.
|
||
- **Security & Performance**: Carefully configured for deployment with production best practices.
|
||
|
||
## Installation
|
||
|
||
### Local Development
|
||
|
||
1. **Clone the repository:**
|
||
|
||
```bash
|
||
git clone https://git.badblocks.dev/badbl0cks/pkmntrade.club.git
|
||
cd pkmntrade.club
|
||
```
|
||
|
||
2. **Install dependencies via uv:**
|
||
|
||
```bash
|
||
uv pip install -r requirements.txt
|
||
```
|
||
|
||
3. **Configure environment variables:**
|
||
|
||
Copy the example environment file and update credentials as needed:
|
||
|
||
```bash
|
||
cp .env .env.production
|
||
```
|
||
|
||
4. **Apply migrations and seed initial data:**
|
||
|
||
```bash
|
||
python manage.py migrate
|
||
python manage.py createsuperuser
|
||
python manage.py createcachetable django_cache
|
||
```
|
||
|
||
5. **Start the development server:**
|
||
|
||
```bash
|
||
uv run manage.py runserver
|
||
```
|
||
|
||
Visit [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser.
|
||
|
||
### Docker Deployment
|
||
|
||
1. **Build and run containers:**
|
||
|
||
```bash
|
||
docker-compose up -d --build
|
||
```
|
||
|
||
2. **Run migrations and create a superuser inside the container:**
|
||
|
||
```bash
|
||
docker-compose exec web python manage.py migrate
|
||
docker-compose exec web python manage.py createsuperuser
|
||
docker-compose exec web python manage.py createcachetable django_cache
|
||
```
|
||
|
||
3. **Access the site:**
|
||
|
||
Open [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||
|
||
## Configuration
|
||
|
||
- **Environment Variables:**
|
||
Manage your local vs. production settings using `.env` and `.env.production`. Update these to match your database credentials, secret keys, and other configurations.
|
||
|
||
- **Django Settings:**
|
||
Production settings are in `django_project/settings.py`.
|
||
|
||
- **Database Settings:**
|
||
Example configuration for PostgreSQL:
|
||
|
||
```python
|
||
DATABASES = {
|
||
'default': {
|
||
'ENGINE': 'django.db.backends.postgresql',
|
||
'NAME': 'postgres',
|
||
'USER': 'postgres',
|
||
'PASSWORD': 'postgres',
|
||
'HOST': 'db', # as defined in docker-compose.yml
|
||
'PORT': 5432,
|
||
}
|
||
}
|
||
```
|
||
|
||
## Database
|
||
|
||
The platform uses PostgreSQL as its primary database in production. For local development, you may use SQLite or configure PostgreSQL by updating your settings and environment variables as needed.
|
||
|
||
## Running Tests
|
||
|
||
Run Django’s testing suite with:
|
||
|
||
```bash
|
||
python manage.py test
|
||
```
|
||
|
||
## Deployment
|
||
|
||
For production deployments consider these additional steps:
|
||
|
||
- **Production Server:** Use a web server like Gunicorn.
|
||
- **Static Files:** Serve static files using Django’s WhiteNoise (or via a CDN).
|
||
- **Fly.io Configuration:** A `fly.toml` file is provided if you wish to deploy on Fly.io.
|
||
- **Deployment Scripts:** Use `deploy.sh` for automated deployment tasks.
|
||
- **Security & Email:** Update `DEFAULT_FROM_EMAIL`, `ALLOWED_HOSTS`, and other security settings in `django_project/settings.py`.
|
||
|
||
## Contributing
|
||
|
||
Contributions, feature requests, and issues are welcome! Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to contribute to PKMN Trade Club.
|
||
|
||
## License
|
||
|
||
This project is licensed under the MIT License. See [LICENSE](./LICENSE) for more information. |