Skip to content

Commit

Permalink
tests fixed & centered navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
u-shev committed Jan 9, 2024
1 parent 1d6059f commit 211cef7
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.celerybeat-schedule
celerybeat-schedule
.dbsqlite
/upload
/__pycache__
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ services:
web-app:
build:
context: .
expose:
- 8000
ports:
- "8000:8000"
volumes:
Expand Down Expand Up @@ -67,7 +65,7 @@ services:
ports:
- "80:8080"
volumes:
- ./space-app/static:/var/www/space-app/static
- ./space-app/media:/var/www/space-app/media
- ./static:/var/www/space-app/static
- ./media:/var/www/space-app/media
depends_on:
- web-app
10 changes: 5 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
run:
poetry run python manage.py runserver 0.0.0.0:8000
poetry run python ./space_app/manage.py runserver 0.0.0.0:8000

install:
poetry install

migrate:
poetry run python3 space_app/manage.py makemigrations
poetry run python3 space_app/manage.py migrate
poetry run python3 ./space_app/manage.py makemigrations
poetry run python3 ./space_app/manage.py migrate

lint:
poetry run flake8 space_app
Expand All @@ -21,9 +21,9 @@ beat:
celery -A space_app beat -l info

test:
poetry run python3 manage.py test
poetry run python3 ./space_app/manage.py test posts users

test-coverage:
poetry run coverage run manage.py test
poetry run coverage run ./space_app/manage.py test posts users
poetry run coverage report -m --include=space_app/* --omit=space_app/settings.py
poetry run coverage xml --include=space_app/* --omit=space_app/settings.py
Empty file added space_app/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions space_app/posts/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.test import TestCase
from space_app.users.models import User
from space_app.posts.models import Post
from .models import User
from .models import Post
from django.urls import reverse_lazy
# import json

Expand Down
19 changes: 12 additions & 7 deletions space_app/space_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,22 @@
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'HOST': os.getenv('POSTGRES_HOST'),
# 'NAME': os.getenv('POSTGRES_DB'),
# 'USER': os.getenv('POSTGRES_USER'),
# 'PASSWORD': os.getenv('POSTGRES_PASSWORD'),
# }
# }
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'HOST': os.getenv('POSTGRES_HOST'),
'NAME': os.getenv('POSTGRES_DB'),
'USER': os.getenv('POSTGRES_USER'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD'),
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -146,7 +151,7 @@
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / "staticfiles"

FIXTURE_DIRS = ['space_app/fixtures']
FIXTURE_DIRS = ['./space_app/fixtures']

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
Expand Down
9 changes: 5 additions & 4 deletions space_app/templates/navbar.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{% load django_bootstrap5 %}

<nav class="navbar navbar-expand-lg navbar-light" data-bs-theme="dark">
<a class="navbar-brand" href="{% url 'home' %}">{{ 'Space for Children' }}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">

{% comment %} <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
</button> {% endcomment %}
<div class="collapse navbar-collapse w-100 justify-content-center" id="navbarNav">
<a class="navbar-brand" href="{% url 'home' %}">{{ 'Space for Children' }}</a>
<ul class="navbar-nav">
{% if user.is_authenticated %}
<li class="nav-item">
Expand Down
2 changes: 1 addition & 1 deletion space_app/users/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.urls import reverse_lazy
from django.test import TestCase
from space_app.users.models import User
from .models import User


class TestCreateUser(TestCase):
Expand Down

0 comments on commit 211cef7

Please sign in to comment.