38 lines
1 KiB
Bash
Executable file
38 lines
1 KiB
Bash
Executable file
# Create and enter virtual environment
|
|
if [ ! -d venv ]; then
|
|
echo Creating virtual environment
|
|
python3 -m venv venv
|
|
fi
|
|
source venv/bin/activate
|
|
|
|
# Install required python packages
|
|
echo Installing required Python packages
|
|
pip install -r requirements.txt
|
|
|
|
# Create and load environment variables from .env
|
|
if [ ! -f .env ]; then
|
|
echo Creating .env
|
|
echo 'DJANGO_SETTINGS_MODULE=drakul.base.settings.development' > .env
|
|
fi
|
|
set -a
|
|
source .env
|
|
set +a
|
|
|
|
|
|
# Set up neat shortcuts
|
|
alias manage='python manage.py'
|
|
alias m=manage
|
|
|
|
function reset() {
|
|
# Delete database
|
|
rm db.sqlite3
|
|
# Delete all migrations
|
|
find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "*/venv/*" -delete
|
|
find . -path "*/migrations/*.pyc" -not -path "*/venv/*" -delete
|
|
# Make and apply migrations
|
|
m makemigrations
|
|
m migrate
|
|
# Create test users
|
|
m shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@localhost', 'admin')"
|
|
}
|