Skip to content

Commit

Permalink
Merge pull request #39 from gcivil-nyu-org/setup-travis-integeration
Browse files Browse the repository at this point in the history
added flake and black changes
  • Loading branch information
Dhiren-NYU authored Oct 24, 2023
2 parents 0b69cb9 + f432e02 commit 42ef28b
Show file tree
Hide file tree
Showing 28 changed files with 2,238 additions and 2,163 deletions.
Binary file added .coverage
Binary file not shown.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
repo_token: syDEBCoOfzHUiOmPUXoSK9J9yTBEEpz57
service_name: travis-pro
2 changes: 2 additions & 0 deletions .elasticbeanstalk/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ branch-defaults:
environment: seproject-cheerup-env
fix-errors:
environment: seproject-cheerup-env
setup-travis-integeration:
environment: seproject-cheerup-env
environment-defaults:
seproject-cheerup-env:
branch: null
Expand Down
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
language: python
dist: bionic
os: linux
python:
- "3.11" # Update to the actual Python 3.11 version when available

before_install:
- pip install 'urllib3<2.0'
- sudo apt-get update

# Define your build steps, for example:
install:
- pip install -r requirements.txt # Install dependencies

script:
- python manage.py test
- python -m black . --check
- python -m flake8 --ignore=E303,E501 --max-line-length=88
- python -m coverage run manage.py test
env:
global:
- AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY

after_success:
coveralls
deploy:
provider: elasticbeanstalk
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: "$AWS_SECRET_ACCESS_KEY"
region: "us-west-2"
app: "CheerUp"
env: "seproject-cheerup-env"
bucket_name: "elasticbeanstalk-us-west-2-623285752572"
# You can add additional steps such as deployment configuration if needed.
2 changes: 1 addition & 1 deletion CheerUp/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CheerUp.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CheerUp.settings")

application = get_asgi_application()
82 changes: 43 additions & 39 deletions CheerUp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,65 +20,69 @@
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-7a(i$_$tw(o7y2(ad4u8==68h4qln2%g&^a#6d+gz4b66j3v$#'
SECRET_KEY = "django-insecure-7a(i$_$tw(o7y2(ad4u8==68h4qln2%g&^a#6d+gz4b66j3v$#"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['seproject-cheerup-env.eba-vmpudkzi.us-west-2.elasticbeanstalk.com','localhost','127.0.0.1']
ALLOWED_HOSTS = [
"seproject-cheerup-env.eba-vmpudkzi.us-west-2.elasticbeanstalk.com",
"localhost",
"127.0.0.1",
]


# Application definition

INSTALLED_APPS = [
'location.apps.LocationConfig',
'events.apps.EventsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"location.apps.LocationConfig",
"events.apps.EventsConfig",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = 'CheerUp.urls'
ROOT_URLCONF = "CheerUp.urls"

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]

WSGI_APPLICATION = 'CheerUp.wsgi.application'
WSGI_APPLICATION = "CheerUp.wsgi.application"


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}

Expand All @@ -88,26 +92,26 @@

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

TIME_ZONE = 'US/Pacific'
TIME_ZONE = "US/Pacific"

USE_I18N = True

Expand All @@ -117,9 +121,9 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'
STATIC_URL = "static/"

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
6 changes: 3 additions & 3 deletions CheerUp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from django.urls import include, path

urlpatterns = [
path('admin/', admin.site.urls),
path('events/', include('events.urls')),
path('locations/', include('location.urls')),
path("admin/", admin.site.urls),
path("events/", include("events.urls")),
path("locations/", include("location.urls")),
]
2 changes: 1 addition & 1 deletion CheerUp/wsgi.py
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', 'CheerUp.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CheerUp.settings")

application = get_wsgi_application()
4 changes: 1 addition & 3 deletions events/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.contrib import admin

# Register your models here.
from django.contrib import admin

from .models import Event

admin.site.register(Event)
admin.site.register(Event)
4 changes: 2 additions & 2 deletions events/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class EventsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'events'
default_auto_field = "django.db.models.BigAutoField"
name = "events"
4 changes: 2 additions & 2 deletions events/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django import forms
from .models import Event


class EventsForm(forms.Form):
model = Event
fields = ['event_name', 'start_time', 'end_time','capacity']

fields = ["event_name", "start_time", "end_time", "capacity"]
32 changes: 23 additions & 9 deletions events/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,37 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
('location', '__first__'),
("location", "__first__"),
]

operations = [
migrations.CreateModel(
name='Event',
name="Event",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('event_name', models.CharField(max_length=200)),
('start_time', models.DateTimeField()),
('end_time', models.DateTimeField()),
('capacity', models.IntegerField()),
('event_location', models.ForeignKey(default=261, on_delete=django.db.models.deletion.CASCADE, to='location.location')),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("event_name", models.CharField(max_length=200)),
("start_time", models.DateTimeField()),
("end_time", models.DateTimeField()),
("capacity", models.IntegerField()),
(
"event_location",
models.ForeignKey(
default=261,
on_delete=django.db.models.deletion.CASCADE,
to="location.location",
),
),
],
),
]
7 changes: 5 additions & 2 deletions events/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from django.db import models
from location.models import Location

# Create your models here.


class Event(models.Model):
event_name = models.CharField(max_length=200)
event_location = models.ForeignKey(Location, on_delete=models.CASCADE, default=261)
start_time = models.DateTimeField()
end_time = models.DateTimeField()
capacity = models.IntegerField()
is_active = models.BooleanField(default = True)
is_active = models.BooleanField(default=True)

def __str__(self):
return self.event_name

3 changes: 0 additions & 3 deletions events/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from django.test import TestCase

# Create your tests here.
13 changes: 6 additions & 7 deletions events/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from . import views

app_name = 'events'
app_name = "events"
urlpatterns = [

path('', views.index, name='index'),
path('create-event', views.createEvent, name='create-event'),
path('save-event/', views.saveEvent, name='save-event'),
path('delete/<int:event_id>/', views.deleteEvent, name='delete-event'),
]
path("", views.index, name="index"),
path("create-event", views.createEvent, name="create-event"),
path("save-event/", views.saveEvent, name="save-event"),
path("delete/<int:event_id>/", views.deleteEvent, name="delete-event"),
]
Loading

0 comments on commit 42ef28b

Please sign in to comment.