Skip to content

Commit

Permalink
Start django-boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
mazulo committed Jun 21, 2017
0 parents commit 6e7a754
Show file tree
Hide file tree
Showing 41 changed files with 594 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory" : "frontend/bower_components"
}
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Python byte-compiled files
__pycache__/

# Environment files
*.sqlite3
/settings/local.py
.DS_Store
/.env
.directory

# Front-end assets and media
/frontend/bower_components
/node_modules
/_public
/_media

# Other cache
/.cache
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

define step
@echo -e "\x1b[34;01m>>> $(1)\x1b[0m"
endef


pip-compile:
# Update requirements/*.txt with latest packages from requirements/*.in
$(call step,Installing/upgrading pip-tools...)
pip install -qU pip-tools

$(call step,Upgrading local packages...)
pip-compile -U requirements/dev.in
pip-compile -U requirements/heroku.in
pip-compile -U requirements/production.in

$(call step,Compiling test requirements...)
pip-compile -U -o requirements/test.txt requirements/production.in requirements/test.in


install-dev-requirements:
# Install requirements for a local development environment
$(call step,Installing dev requirements...)
pip install -qU pip-tools
pip-sync requirements/*.txt

setup-frontend:
bower install --allow-root
2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
release: bin/post_compile
web: gunicorn backend.wsgi --log-file -
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Turbo Send Email #

Web application to send mails in a turbo speed.


## Instructions

### Requirements

- Linux/MacOS
- Git
- Python 3.6

### Instalation

Run the following commands on your terminal:

```bash
$ git clone [email protected]:mazulo/turbo_send_mail.git
$ cd turbo_send_mail
$ pip install -r requirements.txt
$ python manage.py migrate
```

and then...

### Run the server

```bash
$ ./manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
Django version 1.10.5, using settings 'settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
```

### How to use

You can use it by access `http://127.0.0.1:8000/`

### Tests

To run the tests:

```bash
python manage.py test backend
```
15 changes: 15 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "TurboSendMail",
"addons": [
],
"env": {
"DJANGO_DEBUG": "1",
"DJANGO_SECRET_KEY": {
"generator": "secret"
}
},
"buildpacks": [
{"url": "heroku/nodejs"},
{"url": "heroku/python"}
]
}
Empty file added backend/core/__init__.py
Empty file.
Empty file added backend/core/admin.py
Empty file.
9 changes: 9 additions & 0 deletions backend/core/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.apps import AppConfig
from settings.base import BASE_DIR


class DefaultApp(AppConfig):
label = 'core'
name = 'backend.core'
path = BASE_DIR.child('backend', 'core')
verbose_name = 'Core Application'
Empty file added backend/core/forms.py
Empty file.
Empty file.
Empty file added backend/core/models.py
Empty file.
Empty file added backend/core/tests.py
Empty file.
7 changes: 7 additions & 0 deletions backend/core/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.conf.urls import url
from . import views


urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
]
Empty file added backend/core/utils.py
Empty file.
6 changes: 6 additions & 0 deletions backend/core/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.views import generic


class IndexView(generic.TemplateView):

template_name = 'core/index.html'
9 changes: 9 additions & 0 deletions backend/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
# Django admin
url(r'^admin/', include(admin.site.urls)),
# Local apps
url(r'^', include('backend.core.urls', namespace='core')),
]
12 changes: 12 additions & 0 deletions backend/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
WSGI config for valid_credit_card project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
application = get_wsgi_application()
3 changes: 3 additions & 0 deletions bin/post_compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# !/usr/bin/env bash
echo "=> Performing database migrations..."
python manage.py migrate
16 changes: 16 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "turbosendmail",
"authors": [
"Patrick Mazulo <[email protected]>"
],
"description": "",
"main": "",
"license": "COMMERCIAL",
"homepage": "",
"private": true,
"dependencies": {
"jquery": "^3.1.0",
"susy": "^2.2.12",
"semantic": "^2.2.4"
}
}
24 changes: 24 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Rename to .env
DATABASE_URL='postgres://user:password@localhost:5432/database_name'
DEBUG=True

SECRET_KEY=put-an-awesome-secret-key-here
ALLOWED_HOSTS=127.0.0.1

STATIC_URL=
MEDIA_URL=

# Email settings
DEFAULT_FROM_EMAIL=
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
EMAIL_HOST=
SENDGRID_PASSWORD=
SENDGRID_USERNAME=
EMAIL_PORT=587
EMAIL_USE_TLS=True


# Third apps tokens
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=

23 changes: 23 additions & 0 deletions frontend/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@import 'susy';


$susy: (
columns: 12,
container: 1168px,
global-box-sizing: border-box,
gutter-position: split,
gutters: 0.25,
);


body {
background: #eee;

& > * {
@include container;
}
main > section {
@include span(full);
}

}
20 changes: 20 additions & 0 deletions frontend/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% load compress %}
{% load static %}


<!DOCTYPE html>
<html>
<head>
<title>{{ view.title }}</title>

{% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'semantic/dist/semantic.css' %}">
<link rel="stylesheet" type="text/x-scss" href="{% static 'styles/main.scss' %}">
{% endcompress %}
</head>
<body>
<main id="{{ view.title|slugify }}">
{% block content %}{% endblock content %}
</main>
</body>
</html>
5 changes: 5 additions & 0 deletions frontend/templates/core/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends 'base.html' %}


{% block content %}
{% endblock content %}
10 changes: 10 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "TurboSendMail",
"description": "This application will send emails in a turbo speed.",
"version": "1.0.0",
"author": "Patrick Mazulo",
"dependencies": {
"bower": "1.7.9"
},
"license": "UNLICENSED",
"repository": "https://github.com/mazulo/turbo_send_mail",
"engines": {
"node": "5.11.1"
},
"scripts": {
"heroku-postbuild": "./node_modules/.bin/bower install"
}
}
26 changes: 26 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Our favorite web framework
Django==1.11.2

# Read sensitive settings from the environment
python-decouple==3.0

# Ease path/files operations
Unipath==1.1

# 12fator-like database URL parser
dj-database-url==0.4.2

# Static files manager
django-compressor==2.1.1

# Static files compilers
libsass==0.13.2

# PostgreSQL driver
psycopg2==2.7.1

# The WSGI server of choice
gunicorn==19.7.1

# Support static files on Heroku
whitenoise==3.3.0
1 change: 1 addition & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r production.in
21 changes: 21 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/dev.txt requirements/dev.in
#
click==6.7 # via python-dotenv
dj-database-url==0.4.2
django-appconf==1.0.2 # via django-compressor
django-compressor==2.1.1
django==1.11.2
gunicorn==19.7.1
libsass==0.13.2
psycopg2==2.7.1
python-decouple==3.0
python-dotenv==0.6.4
pytz==2017.2 # via django
rcssmin==1.0.6 # via django-compressor
rjsmin==1.0.12 # via django-compressor
six==1.10.0 # via libsass
unipath==1.1
2 changes: 2 additions & 0 deletions requirements/heroku.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r production.in
whitenoise
22 changes: 22 additions & 0 deletions requirements/heroku.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/heroku.txt requirements/heroku.in
#
click==6.7 # via python-dotenv
dj-database-url==0.4.2
django-appconf==1.0.2 # via django-compressor
django-compressor==2.1.1
django==1.11.2
gunicorn==19.7.1
libsass==0.13.2
psycopg2==2.7.1
python-decouple==3.0
python-dotenv==0.6.4
pytz==2017.2 # via django
rcssmin==1.0.6 # via django-compressor
rjsmin==1.0.12 # via django-compressor
six==1.10.0 # via libsass
unipath==1.1
whitenoise==3.3.0
9 changes: 9 additions & 0 deletions requirements/production.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dj-database-url
python-decouple
Django
psycopg2
python-dotenv
gunicorn
django_compressor
libsass
unipath
Loading

0 comments on commit 6e7a754

Please sign in to comment.