-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18e180e
commit ec23270
Showing
48 changed files
with
1,102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.git | ||
|
||
# Make absolutely sure production settings never get into Docker | ||
.envs | ||
|
||
# Don't put the static sources into the container | ||
assets/src | ||
|
||
# Django & Python ignores | ||
**/*.sqlite3 | ||
**/*.pyc | ||
**/__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{py,rst,ini}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{html,css,scss,vue,json,yml,js}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Django settings | ||
DJANGO_SETTINGS_MODULE=config.settings.production | ||
SECRET_KEY= | ||
|
||
# Gunicorn settings | ||
WEB_CONCURRENCY=4 | ||
|
||
# Ad server settings | ||
ADSERVER_HTTPS=False | ||
ADSERVER_ADMIN_URL=admin | ||
|
||
# Using Sqlite is fine for a local test | ||
#DATABASE_URL=sqlite:///db.sqlite3 | ||
# PostgreSQL is better for a real production instance | ||
DATABASE_URL=psql://username:[email protected]:5432/database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
### OSX ### | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
### SublimeText ### | ||
# cache files for sublime text | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
|
||
# workspace files are user-specific | ||
*.sublime-workspace | ||
|
||
# project files should be checked into the repository, unless a significant | ||
# proportion of contributors will probably not be using SublimeText | ||
# *.sublime-project | ||
|
||
# sftp configuration file | ||
sftp-config.json | ||
|
||
# Basics | ||
*.py[cod] | ||
__pycache__ | ||
|
||
# Logs | ||
*.log | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
htmlcov | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Pycharm | ||
.idea/* | ||
|
||
|
||
# Vim | ||
*~ | ||
*.swp | ||
*.swo | ||
|
||
# npm | ||
node_modules/ | ||
|
||
# Compass | ||
.sass-cache | ||
|
||
# User-uploaded media | ||
techint/media/ | ||
|
||
# MailHog binary | ||
mailhog | ||
|
||
|
||
########################################################################## | ||
# Ad Server specific ignores | ||
########################################################################## | ||
|
||
# Production settings | ||
.envs/production.env | ||
|
||
# Compiled static files | ||
assets/dist | ||
static | ||
|
||
# Development database | ||
db.sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.PHONY: help test clean dockerbuild dockerserve dockershell | ||
|
||
CONTAINER_NAME = ethicaladserver | ||
CONTAINER_ENVS = .envs/production.env | ||
|
||
help: | ||
@echo "Please use \`make <target>' where <target> is one of" | ||
@echo " test Run the full test suite" | ||
@echo " clean Delete assets processed by webpack" | ||
@echo " dockerbuild Build a docker container of the ad server" | ||
@echo " dockerserve Run the docker container for the ad server on port 5000" | ||
@echo " dockershell Connect to a shell on the docker container" | ||
|
||
test: | ||
tox | ||
|
||
clean: | ||
rm -rf assets/dist/* | ||
|
||
dockerbuild: clean | ||
npm run build-production | ||
docker build -t $(CONTAINER_NAME) -f deploy/Dockerfile . | ||
|
||
dockerserve: | ||
docker container run --env-file $(CONTAINER_ENVS) --publish 5000:5000 $(CONTAINER_NAME) | ||
|
||
dockershell: | ||
docker container run --env-file $(CONTAINER_ENVS) -it $(CONTAINER_NAME) /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
================= | ||
Ethical Ad Server | ||
================= | ||
|
||
The Ethical Ad Server is an advertising server without all the tracking. | ||
It is created by Read the Docs to serve the ads on Read the Docs. | ||
|
||
|
||
Features | ||
-------- | ||
|
||
* Supports banners, banner+text, and text-only ads | ||
* Extensive and extensible ad fraud prevention | ||
* Reports based on campaign, flight, or individual ad | ||
* DoNotTrack ready | ||
* GDPR ready | ||
* Geographical targeting by country and state/province | ||
* Supports custom targeting parameters | ||
|
||
The Ethical Ad Server uses GeoLite2 data created by MaxMind. | ||
|
||
|
||
Developing | ||
---------- | ||
|
||
To setup your environment and run a local development server:: | ||
|
||
$ npm install | ||
$ npm run build | ||
$ pip install -r requirements/development.txt | ||
$ python3 manage.py runserver # This server runs on Python 3.6+ | ||
|
||
To run the unit tests:: | ||
|
||
$ make test | ||
|
||
To build the production Docker container:: | ||
|
||
$ make dockerbuild | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin # noqa | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AdserverConfig(AppConfig): | ||
name = 'adserver' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models # noqa | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
{% block start_head %}{% endblock start_head %} | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="description" content="{% block meta_description %}{% endblock meta_description %}"> | ||
{% block metas %}{% endblock metas %} | ||
|
||
<title>{% block fulltitle %}{% block shorttitle %}{% endblock shorttitle %} - Ethical Ad Server{% endblock fulltitle %}</title> | ||
|
||
{% block css %}{% endblock css %} | ||
|
||
{% block end_head %}{% endblock end_head %} | ||
</head> | ||
|
||
<body class="{% block classes_body %}{% endblock classes_body %}"> | ||
|
||
{% block start_body %}{% endblock start_body %} | ||
|
||
{% block main_body %}Ethical Ad Server {{ version }}{% endblock main_body %} | ||
|
||
{% block end_body %}{% endblock end_body %} | ||
|
||
{% block js %}{% endblock js %} | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase # noqa | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.conf.urls import url | ||
|
||
from .views import dashboard | ||
|
||
|
||
urlpatterns = [ | ||
url('^$', dashboard), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.conf import settings | ||
from django.contrib.auth.decorators import login_required | ||
from django.shortcuts import render | ||
|
||
|
||
@login_required | ||
def dashboard(request): | ||
return render(request, 'adserver/dashboard.html', { | ||
'version': settings.ADSERVER_VERSION, | ||
}) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// JavaScript requirements | ||
import * as jquery from 'jquery'; | ||
import * as bootstrap from 'bootstrap'; | ||
|
||
// CSS includes | ||
import './scss/index.scss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background-color: $gray-100; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$primary: #17a2b8; /* cyan */ | ||
$warning: #ffc107; /* yellow */ | ||
|
||
$jumbotron-height: 25rem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import "_variables.scss"; | ||
@import "~bootstrap/scss/bootstrap.scss"; | ||
|
||
$fa-font-path: "~font-awesome/fonts"; | ||
@import "~font-awesome/scss/font-awesome.scss"; | ||
|
||
@import "theme.scss"; |
Empty file.
Empty file.
Oops, something went wrong.