Skip to content

Commit

Permalink
Issue 12, move parte do django (backend) para uma pasta separada, ass…
Browse files Browse the repository at this point in the history
…im na raiz fica apenas coisas fora do backend.
  • Loading branch information
huogerac committed Nov 6, 2022
1 parent 44a42b5 commit 53f4cc5
Show file tree
Hide file tree
Showing 28 changed files with 26 additions and 21 deletions.
3 changes: 2 additions & 1 deletion meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = {
// "completeMessage": "{{#inPlace}}To get started:\n\n npm install\n npm run dev.{{else}}To get started:\n\n cd {{destDirName}}\n npm install\n npm run dev.{{/inPlace}}",
"complete": function (data, {logger, chalk}) {
const base = data.inPlace ? '' : data.destDirName + '/'
fs.rename(`${base}__name__`, `${base}${data.name}`, onerror)
fs.rename(`${base}{{name}}/{{name}}`, `${base}{{name}}/${data.name}`, onerror)
fs.rename(`${base}{{name}}`, `${base}${data.name}`, onerror)
cmds = data.inPlace ? '' : `cd ${data.destDirName}\n `
cmds += `follow the instructions on README.md
(or see https://github.com/evolutio/djavue/blob/master/template/README.md)`
Expand Down
2 changes: 1 addition & 1 deletion template/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{name}}.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{name}}.{{name}}.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
2 changes: 1 addition & 1 deletion template/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool:pytest]
DJANGO_SETTINGS_MODULE = {{ name }}.settings
DJANGO_SETTINGS_MODULE = {{name}}.{{ name }}.settings
python_files = tests.py test_*.py *_tests.py
addopts = -x -vv

Expand Down
4 changes: 2 additions & 2 deletions template/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[uwsgi]

env = DJANGO_SETTINGS_MODULE={{name}}.settings
env = DJANGO_SETTINGS_MODULE={{name}}.{{name}}.settings
chdir = /app
module = {{name}}.wsgi
module = {{name}}.{{name}}.wsgi
master = true
processes = 3
http = :8000
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion template/core/admin.py → template/{{name}}/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from core.models import ActivityLog, Todo
from .models import ActivityLog, Todo


class ActivityLogAdmin(admin.ModelAdmin):
Expand Down
2 changes: 1 addition & 1 deletion template/core/apps.py → template/{{name}}/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
name = '{{name}}.core'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from core.models import ActivityLog
from ..models import ActivityLog
import json


def log_login(user):
logs = ActivityLog(
type='login',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from core.models import Todo
from ..models import Todo


def add_todo(new_task):
todo = Todo(description=new_task)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from core.models import User
from {{name}}.core.models import User


def user_jon():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from core.models import User
from core.tests import fixtures
from {{name}}.core.models import User
from . import fixtures


def test_deve_retornar_usuario_nao_logado(client):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from core.models import User, Todo
from core.tests import fixtures
from {{name}}.core.models import User, Todo
from . import fixtures


def test_criar_tarefa_sem_login(client):
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions template/core/views.py → template/{{name}}/core/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# coding: utf-8
import json

from django.http import HttpResponse, JsonResponse
from django.contrib import auth
from commons.django_views_utils import ajax_login_required
from core.service import log_svc, todo_svc
from django.views.decorators.csrf import csrf_exempt

from ..commons.django_views_utils import ajax_login_required
from .service import log_svc, todo_svc


def dapau(request):
raise Exception('break on purpose')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
]

LOCAL_APPS = [
'core',
'{{name}}.core',
]

INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
Expand All @@ -66,7 +66,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = '{{name}}.urls'
ROOT_URLCONF = '{{name}}.{{name}}.urls'

TEMPLATES = [
{
Expand All @@ -84,7 +84,7 @@
},
]

WSGI_APPLICATION = '{{name}}.wsgi.application'
WSGI_APPLICATION = '{{name}}.{{name}}.wsgi.application'


# Database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
urlpatterns = [
path('admin/', admin.site.urls),
# path('explorer/', include('explorer.urls')),
path('api/', include('core.urls')),
path('api/', include('{{name}}.core.urls')),
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{name}}.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{name}}.{{name}}.settings")

application = get_wsgi_application()

0 comments on commit 53f4cc5

Please sign in to comment.