Verified Commit 911a2a00 authored by David Haynes's avatar David Haynes 🙆
Browse files

Rename app from "website" -> "api" and consistant whats-open

- also settings/ added
- also renamed whats_open to whats-open to be consistant with repo name
- updated docker and CI accordingly
parent 6c61a0c0
......@@ -12,7 +12,7 @@ before_script:
- apt-get update -qy
- apt-get install -y mysql-client libmysqlclient-dev python-mysqldb
- pip install -r requirements/test.txt
- cd whats_open/
- cd whats-open/
- export WOPEN_SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
- export WOPEN_EMAIL_DOMAIN="@masonlive.gmu.edu"
- export WOPEN_DB_NAME="wopen"
......@@ -22,7 +22,7 @@ before_script:
- export WOPEN_DB_PORT=3306
- export WOPEN_SUPERUSER=admin
- python manage.py makemigrations
- python manage.py makemigrations website
- python manage.py makemigrations api
- python manage.py migrate
- echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('root', 'root@srct.gmu.edu', 'root') " | python manage.py shell
......@@ -42,7 +42,6 @@ whats-open-py3.6:
image: library/python:3.6
type: test
script:
- python manage.py test
- if pip list --outdated --format=legacy | grep "Latest" | wc -l > 0; then echo "Please update your dependecies!" && pip list --outdated --format=legacy && exit 1; else exit 0; fi
- coverage run --source=website --omit=*migrations/*,*admin.py,*__init__.py,*.pyc manage.py test
- coverage run --source=api --omit=*migrations/*,*admin.py,*__init__.py,*.pyc manage.py test
- coverage html -i && grep pc_cov htmlcov/index.html | egrep -o "[0-9]+\%" | awk '{ print "covered " $1;}'
......@@ -6,9 +6,9 @@ done
export WOPEN_SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
python whats_open/manage.py flush --no-input
python whats_open/manage.py makemigrations
python whats_open/manage.py makemigrations website
python whats_open/manage.py migrate
echo "from django.contrib.auth.models import User; User.objects.filter(email='$WOPEN_SUPERUSER$WOPEN_EMAIL_DOMAIN').delete(); User.objects.create_superuser('$WOPEN_SUPERUSER$WOPEN_EMAIL_DOMAIN', '$WOPEN_SUPERUSER', 'admin')" | python whats_open/manage.py shell
python whats_open/manage.py runserver 0.0.0.0:8000
python whats-open/manage.py flush --no-input
python whats-open/manage.py makemigrations
python whats-open/manage.py makemigrations api
python whats-open/manage.py migrate
echo "from django.contrib.auth.models import User; User.objects.filter(email='$WOPEN_SUPERUSER$WOPEN_EMAIL_DOMAIN').delete(); User.objects.create_superuser('$WOPEN_SUPERUSER$WOPEN_EMAIL_DOMAIN', '$WOPEN_SUPERUSER', 'admin')" | python whats-open/manage.py shell
python whats-open/manage.py runserver 0.0.0.0:8000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-29 19:53
from __future__ import unicode_literals
import autoslug.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('name', models.CharField(max_length=100)),
],
options={
'verbose_name': 'category',
'verbose_name_plural': 'categories',
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Facility',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('name', models.CharField(max_length=100)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True)),
('facility_category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='facilities', to='api.Category')),
],
options={
'verbose_name': 'facility',
'verbose_name_plural': 'facilities',
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Location',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('building', models.CharField(max_length=100)),
('address', models.CharField(max_length=100)),
('on_campus', models.BooleanField(default=True)),
],
options={
'verbose_name': 'location',
'verbose_name_plural': 'locations',
},
),
migrations.CreateModel(
name='OpenTime',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('start_day', models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')], default=0)),
('start_time', models.TimeField()),
('end_day', models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')], default=0)),
('end_time', models.TimeField()),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Schedule',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('name', models.CharField(max_length=100)),
('valid_start', models.DateField(blank=True, help_text='Date that this schedule goes\n into effect', null=True, verbose_name='Start Date')),
('valid_end', models.DateField(blank=True, help_text='Last day that this schedule is\n in effect', null=True, verbose_name='End Date')),
],
options={
'ordering': ['name'],
},
),
migrations.AddField(
model_name='opentime',
name='schedule',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='open_times', to='api.Schedule'),
),
migrations.AddField(
model_name='facility',
name='facility_location',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='facilities', to='api.Location'),
),
migrations.AddField(
model_name='facility',
name='main_schedule',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='facility_main', to='api.Schedule'),
),
migrations.AddField(
model_name='facility',
name='owners',
field=models.ManyToManyField(to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='facility',
name='special_schedules',
field=models.ManyToManyField(blank=True, help_text='This schedule will\n come into effect\n only for its\n specified duration.\n ', related_name='facility_special', to='api.Schedule'),
),
]
......@@ -3,7 +3,7 @@ import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "whats_open.settings.local")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
from django.core.management import execute_from_command_line
......
......@@ -12,9 +12,6 @@ DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project folder:
SITE_ROOT = dirname(DJANGO_ROOT)
# Site name:
SITE_NAME = basename(DJANGO_ROOT)
# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(DJANGO_ROOT)
......@@ -187,14 +184,14 @@ MIDDLEWARE_CLASSES = (
########## URL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
ROOT_URLCONF = '%s.urls' % SITE_NAME
ROOT_URLCONF = 'settings.urls'
########## END URL CONFIGURATION
########## WSGI CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = '%s.wsgi.application' % SITE_NAME
WSGI_APPLICATION = 'settings.wsgi.application'
########## END WSGI CONFIGURATION
......@@ -226,7 +223,7 @@ INSTALLED_APPS = (
'django.contrib.admindocs',
# Apps specific for this project go here.
'website',
'api',
'rest_framework',
)
......
......@@ -11,7 +11,7 @@ admin.autodiscover()
urlpatterns = [
# / - The homepage
url(r'^', include('website.urls')),
url(r'^', include('api.urls')),
# /admin - The admin panels
url(r'^admin/', include(admin.site.urls)),
......
......@@ -15,7 +15,7 @@ framework.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "whats_open.settings.production")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.production")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment