Skip to content

Commit

Permalink
Use template file instead of development.py
Browse files Browse the repository at this point in the history
- Add make init and run commands
- Update README.md
  • Loading branch information
pehala committed Sep 10, 2023
1 parent 5fc19e3 commit 81cf541
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ immortalfighters/static/
.env
db.sqlite3
/chords/static/
/chords/settings/production.py

#Python virtual environment
venv/
Expand Down
34 changes: 22 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,37 @@
commit-acceptance: black pylint
pre-commit: locale migrations

RUN = poetry run
MANAGE = $(RUN) python manage.py

pylint:
poetry run pylint backend/ chords/ pdf/ frontend/ category/ analytics/ --django-settings-module=chords.settings.development
$(RUN) pylint backend/ chords/ pdf/ frontend/ category/ analytics/ --django-settings-module=chords.settings.production

black:
poetry run black --check . --diff
$(RUN) black --check . --diff

reformat:
poetry run black .
$(RUN) black .

locale:
poetry run python manage.py makemessages -l cs
$(MANAGE) makemessages -l cs

migrations:
poetry run python manage.py makemigrations

deploy:
poetry run python manage.py migrate
poetry run python manage.py compilescss
poetry run python manage.py prerender
poetry run python manage.py compilemessages
poetry run python manage.py collectstatic --noinput
$(MANAGE) makemigrations

deploy: ## Deploys to production
$(MANAGE) migrate
$(MANAGE) compilescss
$(MANAGE) prerender
$(MANAGE) compilemessages
$(MANAGE) collectstatic --noinput

init: ## Initializes project for development
cp chords/settings/production.py.tpl chords/settings/production.py
$(MANAGE) migrate

run: ## Runs the development server
$(MANAGE) runserver

# Check http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## Print this help
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ First clone the repository from Github and switch to the new directory:

Install pipenv and dependencies

$ pip install pipenv
$ pipenv install
$ python -m pip install poetry
$ poetry install

Then simply apply the migrations:
Then simply initialize the website:

$ pipenv run python manage.py migrate
$ make init

You can now run the development server:

$ pipenv run python manage.py runserver
$ make run

## FAQ

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chords.settings.development")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chords.settings.production")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down

0 comments on commit 81cf541

Please sign in to comment.