Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
792babe
Merge pull request #1 from CS24-Build-Week-1/development
jjgorton Jan 7, 2020
e792a39
endpoint for api/adv/rooms working
anthonyrende Jan 7, 2020
8390c6a
testing deploy
lavonmejia Jan 7, 2020
305c31d
added secret key
lavonmejia Jan 7, 2020
24f0ff2
added env variables
lavonmejia Jan 7, 2020
0158cf8
testing import addition
lavonmejia Jan 7, 2020
38f63f8
added database url
lavonmejia Jan 7, 2020
13e6c99
removed dictionary from databases
lavonmejia Jan 7, 2020
c4f9f0a
Merge pull request #2 from CS24-Build-Week-1/heroku-testing
anthonyrende Jan 7, 2020
c775a7d
configuring world generation
anthonyrende Jan 8, 2020
5c82f40
working connections and rooms
lavonmejia Jan 8, 2020
4f18269
pushing to deploy with rooms
lavonmejia Jan 8, 2020
a149f21
updated char length on descriptions
lavonmejia Jan 8, 2020
94c0836
Merge pull request #3 from CS24-Build-Week-1/models-mejia
anthonyrende Jan 8, 2020
6468c5d
Merge branch 'master' of https://github.com/CS24-Build-Week-1/Back-En…
anthonyrende Jan 8, 2020
7485097
init and rooms working locally with 100+ rooms
anthonyrende Jan 8, 2020
465add4
typeerror fix
anthonyrende Jan 8, 2020
a628e6e
comment out local database
anthonyrende Jan 8, 2020
abf56f1
Merge pull request #4 from CS24-Build-Week-1/rooms
lavonmejia Jan 8, 2020
d04397d
admin.py updated for django backend
lavonmejia Jan 8, 2020
9f78471
Merge branch 'master' into models-mejia
anthonyrende Jan 8, 2020
1c08e8d
Merge pull request #5 from CS24-Build-Week-1/models-mejia
anthonyrende Jan 8, 2020
f0fdf0d
pos_y hotfix
anthonyrende Jan 9, 2020
9acbbf0
Update admin.py
lavonmejia Jan 9, 2020
35eac8f
added room_id to init endpoint
anthonyrende Jan 9, 2020
84ca096
Merge branch 'master' of https://github.com/CS24-Build-Week-1/Back-End
anthonyrende Jan 9, 2020
38c7dac
adding more rooms to get more connections
lavonmejia Jan 9, 2020
8d384c0
added east west to the django admin
lavonmejia Jan 9, 2020
b885857
added request to user.player in api
anthonyrende Jan 9, 2020
76bdfa9
Merge branch 'master' of https://github.com/CS24-Build-Week-1/Back-End
anthonyrende Jan 9, 2020
b9b4082
added pos_x and pos_y fields to endpoints
anthonyrende Jan 9, 2020
832f546
world_generating algorithm, error on init()
anthonyrende Jan 10, 2020
8cc1a14
noneType object has no attribute save
anthonyrende Jan 10, 2020
04fe0e8
fixed both, now index error pop from empty list
anthonyrende Jan 10, 2020
af82fd8
list index out of range grid[x][y]
anthonyrende Jan 10, 2020
0afd03e
fixed those, error saving to database
anthonyrende Jan 10, 2020
59faf33
AttributeError: 'RoomModel' object has no attribute 'save'
anthonyrende Jan 10, 2020
c7f3a91
WIP attribute error
anthonyrende Jan 10, 2020
adb29b5
adding inventory and methods to player class
anthonyrende Jan 10, 2020
b17845c
Item class and item methods for player class
anthonyrende Jan 10, 2020
43a5dcd
create_items.py script spawns items
anthonyrende Jan 10, 2020
c8a6306
dictionary of items, spawn_item method
anthonyrende Jan 10, 2020
9cb0d75
updating api for items
anthonyrende Jan 10, 2020
e6a4aea
migrated new fields and Item model to local db
anthonyrende Jan 10, 2020
b35b82b
fixed attribute errors, server running
anthonyrende Jan 10, 2020
edd6330
add Item to django admin interface
anthonyrende Jan 11, 2020
68f65aa
ran create_items script, working! migrated items-- storing items in d…
anthonyrende Jan 11, 2020
210db4e
items are being added to rooms!
anthonyrende Jan 11, 2020
532fc37
fixed random item spawns in random rooms!
anthonyrende Jan 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "/home/ant/.local/share/virtualenvs/Back-End-F0vZ22a3/bin/python"
"python.pythonPath": "/usr/bin/python3"
}
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ Then push to heroku.

Creating your Django project within OneDrive causes problems.

Repeat setup & install steps in a new directory, _outside_ of OneDrive.
Repeat setup & install steps in a new directory, _outside_ of OneDrive.

4 changes: 3 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ django-cors-headers = "*"
gunicorn = "*"
django-heroku = "*"
django-rest-api = "*"
psycopg2-binary = "*"
dj-database-url = "*"
whitenoise = "*"

[dev-packages]
pylint = "*"

[requires]
python_version = "3.7"
139 changes: 42 additions & 97 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web: gunicorn adv_project.wsgi:application --log-file -
web: gunicorn adv_project.wsgi:application --log-file -

39 changes: 29 additions & 10 deletions adv_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

import os
from decouple import config
import dj_database_url



# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand All @@ -21,15 +24,17 @@
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
# SECRET_KEY = config('SECRET_KEY')
SECRET_KEY = config('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = config('DEBUG', cast=bool)
DEBUG = True
DEBUG = config('DEBUG', cast=bool)
# DEBUG = True

# ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=lambda v: [s.strip() for s in v.split(',')])
ALLOWED_HOSTS = []
# ALLOWED_HOSTS = []
ALLOWED_HOSTS = config('ALLOWED_HOSTS')

DATABASE_URL = config('DATABASE_URL')

# Application definition

Expand All @@ -50,6 +55,7 @@
'allauth',
'allauth.account',
'rest_auth.registration',
'adv_project',
]

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Expand Down Expand Up @@ -92,13 +98,22 @@
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
'default':
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
dj_database_url.config(default=DATABASE_URL)

}



# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }

# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -151,5 +166,9 @@

STATIC_URL = '/static/'

# import django_heroku
# django_heroku.settings(locals())
import django_heroku
django_heroku.settings(locals())


# Workaround for local dj_database_url issue; commenting out by default
del DATABASES['default']['OPTIONS']['sslmode']
8 changes: 4 additions & 4 deletions adv_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from rest_framework.authtoken import views


from adventure.api import RoomViewSet
# from adventure.api import RoomViewSet


router = routers.DefaultRouter()
router.register(r'rooms', RoomViewSet)
# router = routers.DefaultRouter()
# router.register(r'rooms', RoomViewSet)

urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('api.urls')),
path('api/adv/', include('adventure.urls')),
path('api/', include(router.urls)),
# path('api/', include(router.urls)),
]
1 change: 1 addition & 0 deletions adv_project/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'adv_project.settings')

application = get_wsgi_application()

26 changes: 23 additions & 3 deletions adventure/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
from django.contrib import admin

from .models import Room, Player
from .models import Room, Player, Item
# from .world_generate import World

class RoomInline(admin.TabularInline):
model = Room

admin.site.register(Room)
admin.site.register(Player)
class PlayerInline(admin.TabularInline):
model = Player

class ItemInline(admin.TabularInline):
model = Item

class RoomAdmin(admin.ModelAdmin):
list_display = ('title', 'description', 'n_to','s_to','e_to','w_to','pos_x', 'pos_y')

class PlayerAdmin(admin.ModelAdmin):
list_display = ('user','currentRoom','uuid', 'inventory')

class ItemAdmin(admin.ModelAdmin):
list_display = ('name', 'description') #took out 'location'


admin.site.register(Room, RoomAdmin)
admin.site.register(Player, PlayerAdmin)
admin.site.register(Item, ItemAdmin)
Loading