added scripts and docker info
This commit is contained in:
parent
6c613fed68
commit
579dab8d0a
0
.dockerignore
Normal file
0
.dockerignore
Normal file
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM python:3
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
WORKDIR /code
|
||||||
|
COPY requirements.txt /code/
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
COPY . /code/
|
||||||
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
command: python manage.py runserver 0.0.0.0:8000
|
||||||
|
volumes:
|
||||||
|
- ./app/:/usr/src/app/
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 8060:8000
|
||||||
|
# env_file:
|
||||||
|
# - ./.venv
|
||||||
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
django
|
||||||
|
black
|
||||||
|
psycopg
|
||||||
|
pandas
|
||||||
|
django-crispy-forms
|
||||||
|
crispy-bootstrap4
|
||||||
21
scripts/clear_logs.sh
Normal file
21
scripts/clear_logs.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define the log directory path
|
||||||
|
LOG_DIR="./resources/logs/"
|
||||||
|
|
||||||
|
# Check if the directory exists
|
||||||
|
if [ -d "$LOG_DIR" ]; then
|
||||||
|
# If it exists, check if there are any .log files in it
|
||||||
|
if ls "$LOG_DIR"*.log 1> /dev/null 2>&1; then
|
||||||
|
# If there are log files, remove them
|
||||||
|
rm "$LOG_DIR"*.log
|
||||||
|
echo "Log files removed from $LOG_DIR."
|
||||||
|
else
|
||||||
|
# If no log files are found
|
||||||
|
echo "No log files found in $LOG_DIR."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# If the directory does not exist, create it
|
||||||
|
mkdir "$LOG_DIR"
|
||||||
|
echo "Directory $LOG_DIR created."
|
||||||
|
fi
|
||||||
4
scripts/deploy.sh
Normal file
4
scripts/deploy.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
docker stop django_web_web_1
|
||||||
|
docker rm django_web_web_1
|
||||||
|
docker-compose build --no-cache
|
||||||
|
docker-compose up -d
|
||||||
29
scripts/setup_env.sh
Normal file
29
scripts/setup_env.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Create the virtual environment in the current directory
|
||||||
|
echo "Checking to see if virtual environment exists..."
|
||||||
|
if [ -d .venv ]; then
|
||||||
|
# echo "Virtual environment already exists. Please delete it before running this script."
|
||||||
|
# exit 1
|
||||||
|
echo "Virtual environment already exists. Skipping creation."
|
||||||
|
else
|
||||||
|
echo "Virtual environment does not exist. Creating..."
|
||||||
|
python3.12 -m venv .venv
|
||||||
|
echo "Virtual environment created."
|
||||||
|
fi
|
||||||
|
# python -m venv .venv
|
||||||
|
|
||||||
|
# Activate the virtual environment
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
# Install the required packages from the requirements.txt file
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Upgrade pip
|
||||||
|
pip install --upgrade pip
|
||||||
|
|
||||||
|
# Print a success message
|
||||||
|
echo "Virtual environment created and requirements installed successfully."
|
||||||
Loading…
Reference in New Issue
Block a user