Skip to content

Commit

Permalink
Add fixtures with example games and game categories
Browse files Browse the repository at this point in the history
  • Loading branch information
zentala committed Dec 17, 2023
1 parent d7ddaf6 commit 1c68f45
Show file tree
Hide file tree
Showing 16 changed files with 323 additions and 383 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
python-version: [3.7, 3.8, 3.9]

steps:

- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -34,15 +34,14 @@ jobs:
# python manage.py test

- name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: # optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path:
# The desired behavior if no files are found using the provided path
error: ""

if-no-files-found: # optional, default is warn

retention-days: # optiona
uses: actions/[email protected]
with:
# Artifact name
# name: # optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
# path:
# The desired behavior if no files are found using the provided path
error: ""

# if-no-files-found: # optional, default is warn
# retention-days: # optiona
Empty file modified .vscode/task_check_environment.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ django-allauth = "*"
[dev-packages]

[requires]
python_version = "3.8"
python_version = "3.10"
38 changes: 22 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ Contribute to the "Game Player Nick Finder" project by:

Your input helps us evolve and improve the platform for the benefit of all gamers.

## Installation and Running the Application Locally
### Installation and Running the Application Locally
Before you proceed, ensure that your system has the following installed:
* Python (version 3.6 or newer)
* pip (Python package management tool) [sudo apt install python3-pip]
* pipenv (Python packaging tool for virtual environments) [pip install pipenv]

### Step 1: Clone the Repository
#### Step 1: Clone the Repository
Clone the repository to your local computer using the following git command:

```bash
git clone https://github.com/zentala/game_player_nick_finder
cd game_player_nick_finder
```

### Step 2: Setup pipenv
#### Step 2: Setup pipenv
To set up the pipenv environment and install dependencies, run the following command:

```bash
Expand All @@ -69,29 +69,35 @@ pipenv install

This will create a `Pipfile` and `Pipfile.lock` if they don't exist and install all required dependencies.

### Step 3: Activate pipenv Environment
#### Step 3: Activate pipenv Environment
To activate the pipenv environment, use:

```bash
pipenv shell
```

### Step 4: Configure the Database
#### Step 4: Configure the Database
The application uses SQLite as the default database, so there is no need to set up an additional database. You can simply perform the database migration:

```bash
python manage.py migrate
```

### Step 5: Create admin user
#### Step 5: Create admin user
```bash
python manage.py createsuperuser
```

### Step 6: .env Configuration
#### Step 6: Apply fixtures
```bash
python manage.py loaddata app/fixtures/categories_fixtures.json
python manage.py loaddata app/fixtures/games_fixtures.json
```

#### Step 7: .env Configuration
Before using certain features, such as email notifications, you need to configure the environment variables. First, make a copy of the `.env.example` file and rename it to `.env`. Then, update the values with the correct configurations for your environment.

### Step 7: Run the Server
#### Step 8: Run the Server
To start the Django development server, run the following command:

```bash
Expand All @@ -100,17 +106,17 @@ python manage.py runserver

The application should now be accessible at http://localhost:8000/

## Intallation and Deamonizing Application on Server
### Intallation and Deamonizing Application on Server
1) Follow all steps for local installation and startup. Verify that the application is running at http://localhost:8000/.
2) Copy `ecosystem.config.js.manage` or `ecosystem.config.js.wsgi` (recommended) into `ecosystem.config.js` and adjust paths in the configuration file.
3) Daemonize the server using the command `pm2 start ecosystem.config.js`. Ensure you have PM2 installed. If not, you can install it using the command `npm install pm2 -g`.
4) Configure the nginx server to handle requests under a specific domain and add an SSL Certificate. You can use Let's Encrypt for a free SSL certificate. Keep in mind that nginx configuration may vary depending on your operating system and specific requirements.

## Options in manage.py
### Options in manage.py

`manage.py` is a script file in Django that allows you to manage the application and execute various commands. Here are several useful options provided by `manage.py`:

### `flush`
#### `flush`

The `flush` command removes all data from the database while leaving the tables intact. This is useful during testing when you want to clear the database and start tests from a clean state.

Expand All @@ -119,7 +125,7 @@ Example usage:
python manage.py flush
```

### `migrate`
#### `migrate`

The `migrate` command executes database migrations. Migrations are a way to keep the database structure in sync with the data model in the application. It allows creating, modifying, and deleting tables and fields in the database based on changes in the models.

Expand All @@ -128,7 +134,7 @@ Example usage:
python manage.py migrate
```

### `makemigrations`
#### `makemigrations`

The `makemigrations` command is used to generate new migration files based on changes in the application's models. After making changes to the models, use this command to prepare new migrations before applying them with `migrate`.

Expand All @@ -137,7 +143,7 @@ Example usage:
python manage.py makemigrations
```

### `shell`
#### `shell`

The `shell` command runs an interactive Python console with all Django models loaded. This allows for interactive data analysis and experimentation with database operations.

Expand All @@ -146,7 +152,7 @@ Example usage:
python manage.py shell
```

### `createsuperuser`
#### `createsuperuser`

The `createsuperuser` command allows you to create a new superuser for the application. The superuser can log in to the Django admin panel and manage the application data.

Expand All @@ -155,7 +161,7 @@ Example usage:
python manage.py createsuperuser
```

### Other Commands
#### Other Commands

In addition to the ones mentioned above, there are many other commands available in `manage.py` that you can use for various purposes, such as managing users, generating reports, running tests, etc. To see a full list of commands and their descriptions, you can use the `help` command:

Expand Down
65 changes: 65 additions & 0 deletions app/fixtures/categories_fixtures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[
{
"model": "app.gamecategory",
"pk": 1,
"fields": {
"title": "MMORPGs",
"slug": "mmorpgs",
"description": "Massively multiplayer online role-playing games where players can explore vast worlds, complete quests, and connect with a large community of gamers."
}
},
{
"model": "app.gamecategory",
"pk": 2,
"fields": {
"title": "Action and Shooters",
"slug": "action-shooters",
"description": "Fast-paced action and shooter games that offer intense gameplay, strategic team play, and competitive multiplayer experiences."
}
},
{
"model": "app.gamecategory",
"pk": 3,
"fields": {
"title": "Survival and Sandbox",
"slug": "survival-sandbox",
"description": "Survival and sandbox games that challenge players to explore, build, and survive in open-world environments, often with multiplayer support."
}
},
{
"model": "app.gamecategory",
"pk": 4,
"fields": {
"title": "Strategy and MOBA",
"slug": "strategy-moba",
"description": "Strategic and multiplayer online battle arena games that require tactical thinking, team coordination, and in-depth game knowledge."
}
},
{
"model": "app.gamecategory",
"pk": 5,
"fields": {
"title": "Adventure and Social",
"slug": "adventure-social",
"description": "Adventure and social games that focus on storytelling, exploration, and building connections with other players."
}
},
{
"model": "app.gamecategory",
"pk": 6,
"fields": {
"title": "Sports and Racing",
"slug": "sports-racing",
"description": "Competitive sports and racing games that simulate real-world sports, offering both single-player and multiplayer experiences."
}
},
{
"model": "app.gamecategory",
"pk": 7,
"fields": {
"title": "Card and Board Games",
"slug": "card-board-games",
"description": "Digital card and board games that recreate the magic of tabletop gaming in an online environment."
}
}
]
Loading

0 comments on commit 1c68f45

Please sign in to comment.