Skip to content

Commit 9549766

Browse files
committed
Updated requirements, added tests
1 parent e6ddcfa commit 9549766

25 files changed

+1136
-47
lines changed

.coveragerc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[run]
2-
include=
3-
*project/*
4-
*pyms/*
52
omit =
6-
venv/*
3+
venv/*
4+
.tox/*
5+
django_scaffold.egg-info/*
6+
*/apps.py

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ ENV/
104104

105105
pylintReport.txt
106106
db.sqlite3
107-
_build
107+
_build
108+
django_scaffold.egg-info

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: python
2+
sudo: false
3+
cache: false
4+
python:
5+
- '3.6'
6+
install:
7+
- pip install -rrequirements-tests.txt
8+
9+
script:
10+
- coverage erase
11+
- tox
12+
after_success:
13+
- coverage combine
14+
- coveralls
15+
16+
notifications:
17+
email:
18+

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Alberto Vara <[email protected]>

Pipfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
django = ">=3.0.2"
8+
djangorestframework = ">=3.11.0"
9+
django-opentracing = ">=1.1.0"
10+
jaeger-client = ">=4.3.0"
11+
12+
[dev-packages]
13+
coverage = "==4.5.4"
14+
pytest = "*"
15+
pytest-cov = "*"
16+
pylint = "*"
17+
flake8 = "*"
18+
tox = "*"
19+
bandit = "*"
20+
21+
[requires]
22+
python_version = "3.6"
23+
24+
[pipenv]
25+
allow_prereleases = true

Pipfile.lock

+443
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# microservices-scaffold
1+
# microservices-django-scaffold
22
Barebones Python with Django Microservices
33

4+
[![Build Status](https://travis-ci.org/python-microservices/microservices-django-scaffold.svg?branch=master)](https://travis-ci.org/python-microservices/microservices-django-scaffold)
5+
[![Coverage Status](https://coveralls.io/repos/github/python-microservices/microservices-django-scaffold/badge.svg?branch=master)](https://coveralls.io/github/python-microservices/microservices-django-scaffold?branch=master)
6+
[![Requirements Status](https://requires.io/github/python-microservices/microservices-django-scaffold/requirements.svg?branch=master)](https://requires.io/github/python-microservices/microservices-django-scaffold/requirements/?branch=master)
7+
[![Updates](https://pyup.io/repos/github/python-microservices/microservices-django-scaffold/shield.svg)](https://pyup.io/repos/github/python-microservices/microservices-django-scaffold/)
8+
[![Python 3](https://pyup.io/repos/github/python-microservices/microservices-django-scaffold/python-3-shield.svg)](https://pyup.io/repos/github/python-microservices/microservices-django-scaffold/)
9+
10+
411
# Docker
512

613
Create and push the image

common/__init__.py

Whitespace-only changes.

common/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class CommonConfig(AppConfig):
5+
name = 'common'

common/migrations/__init__.py

Whitespace-only changes.

common/models.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import uuid
2+
3+
from django.db import models
4+
5+
6+
class AppModel(models.Model):
7+
"""Set the shared fields of all Models.
8+
Attrs:
9+
idpublic: is the field used to get instances and when the id is exposed in urls,
10+
POST, GET methods.
11+
"""
12+
idpublic = models.UUIDField(default=uuid.uuid4, editable=False, verbose_name=u'Número de referencia')
13+
timestamp = models.DateTimeField(auto_now_add=True)
14+
15+
class Meta:
16+
abstract = True

common/tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Create your tests here.

project/settings.py

-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@
7676

7777
WSGI_APPLICATION = 'project.wsgi.application'
7878

79-
80-
# Database
81-
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
82-
8379
DATABASES = {
8480
'default': {
8581
'ENGINE': 'django.db.backends.sqlite3',

project/settings_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from project.settings import *

project/urls.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
"""project URL Configuration
22
33
The `urlpatterns` list routes URLs to views. For more information please see:
4-
https://docs.djangoproject.com/en/1.11/topics/http/urls/
4+
https://docs.djangoproject.com/en/3.0/topics/http/urls/
55
Examples:
66
Function views
77
1. Add an import: from my_app import views
8-
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
99
Class-based views
1010
1. Add an import: from other_app.views import Home
11-
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
1212
Including another URLconf
13-
1. Import the include() function: from django.conf.urls import url, include
14-
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1515
"""
16-
from django.conf.urls import url, include
1716
from django.contrib import admin
17+
from django.urls import path, include
1818
from rest_framework import routers
1919
from rest_framework_swagger.views import get_swagger_view
2020

2121
from template.views import ColorViewSet
2222

2323
# Routers provide an easy way of automatically determining the URL conf.
2424
router = routers.DefaultRouter()
25-
router.register(r'template', ColorViewSet)
25+
router.register('template', ColorViewSet)
2626

2727
schema_view = get_swagger_view(title='Template API')
2828

2929
urlpatterns = [
30-
url(r'^admin/', admin.site.urls),
31-
url(r'^$', schema_view),
32-
url(r'^', include(router.urls)),
33-
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
30+
path('admin/', admin.site.urls),
31+
path('', schema_view),
32+
path('', include(router.urls)),
33+
path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
3434
]

0 commit comments

Comments
 (0)