Compare commits
4 Commits
10d46b3ec6
...
5765391cd0
Author | SHA1 | Date | |
---|---|---|---|
5765391cd0 | |||
47fe29d4a4 | |||
2ea08f804d | |||
3947477341 |
32
README.md
32
README.md
|
@ -1,2 +1,32 @@
|
||||||
# avalon-django
|
# avalon-django
|
||||||
Resistance: Avalon web app implemented using Django
|
`avalon-django` is a web-app implementation of the tabletop hidden-roles game
|
||||||
|
[The Resistance: Avalon](https://boardgamegeek.com/boardgame/128882/resistance-avalon)
|
||||||
|
powered by the Python web framework [Django](https://www.djangoproject.com/).
|
||||||
|
|
||||||
|
The impetus for implementing the game electronically was to speed up gameplay
|
||||||
|
by having the computer do the bookkeeping and (optionally) having the computer
|
||||||
|
display a history of public actions to reduce discussion about what had happened
|
||||||
|
so far in the game.
|
||||||
|
|
||||||
|
|
||||||
|
## How to play
|
||||||
|
|
||||||
|
Each player must have their own device (usually a smartphone, but any device
|
||||||
|
with a web browser will work) and go to the URL where the game is hosted.
|
||||||
|
(Feel free to
|
||||||
|
[play on my server](https://aweirdimagination.net/apps/avalon-django).)
|
||||||
|
When creating a game, a 6 letter game code will be generated to identify the
|
||||||
|
game for other players to join. Optionally, a shared device (e.g. a TV or
|
||||||
|
large tablet) may be setup as an "observer" to display the public data on
|
||||||
|
a common display (to make the game more social by avoiding everyone
|
||||||
|
constantly looking at their own phone). Once everyone has joined, follow
|
||||||
|
the on-screen instructions to play; the interface is made assuming everyone
|
||||||
|
already knows the basic game rules.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
TODO: Write more detail.
|
||||||
|
|
||||||
|
See the `deploy/awi` branch to see the configuration files used to
|
||||||
|
deploy this on https://avalon.aweirdimagination.net/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from settings import *
|
from .settings import *
|
||||||
|
|
||||||
ALLOWED_HOSTS = [ u'avalon.aweirdimagination.net' ]
|
ALLOWED_HOSTS = [ u'avalon.aweirdimagination.net' ]
|
||||||
|
|
||||||
|
|
|
@ -32,23 +32,13 @@ ALLOWED_HOSTS = []
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'avalon_game.apps.AvalonGameConfig',
|
'avalon_game.apps.AvalonGameConfig',
|
||||||
'django.contrib.admin',
|
|
||||||
'django.contrib.auth',
|
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
|
||||||
'django.contrib.messages',
|
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = [
|
MIDDLEWARE_CLASSES = [
|
||||||
# Does not exist in Django before 1.8.
|
|
||||||
#'django.middleware.security.SecurityMiddleware',
|
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
||||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -63,7 +53,6 @@ TEMPLATES = [
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
'django.template.context_processors.debug',
|
'django.template.context_processors.debug',
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -88,25 +77,6 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
|
||||||
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
|
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,7 @@ Including another URLconf
|
||||||
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
|
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
|
||||||
"""
|
"""
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^', include('avalon_game.urls')),
|
url(r'^', include('avalon_game.urls')),
|
||||||
url(r'^admin/', admin.site.urls),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -29,11 +29,13 @@ class Game(models.Model):
|
||||||
display_history = models.NullBooleanField()
|
display_history = models.NullBooleanField()
|
||||||
private_voting = models.NullBooleanField()
|
private_voting = models.NullBooleanField()
|
||||||
player_assassinated = models.ForeignKey('Player', null=True, default=None,
|
player_assassinated = models.ForeignKey('Player', null=True, default=None,
|
||||||
related_name='+')
|
related_name='+',
|
||||||
|
on_delete=models.PROTECT)
|
||||||
created = models.DateTimeField()
|
created = models.DateTimeField()
|
||||||
ended = models.DateTimeField(null=True, default=None)
|
ended = models.DateTimeField(null=True, default=None)
|
||||||
next_game = models.OneToOneField('self', null=True, default=None,
|
next_game = models.OneToOneField('self', null=True, default=None,
|
||||||
related_name='previous_game')
|
related_name='previous_game',
|
||||||
|
on_delete=models.SET_DEFAULT)
|
||||||
|
|
||||||
# from http://stackoverflow.com/a/11821832
|
# from http://stackoverflow.com/a/11821832
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
|
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
|
||||||
|
|
|
@ -208,7 +208,7 @@ def game_base_context(game, player):
|
||||||
context['num_resistance'] = len([p for p in players if not p.is_spy()])
|
context['num_resistance'] = len([p for p in players if not p.is_spy()])
|
||||||
resistance_roles = [p.role_string() for p in players
|
resistance_roles = [p.role_string() for p in players
|
||||||
if not p.is_spy() and p.role != Player.ROLE_GOOD]
|
if not p.is_spy() and p.role != Player.ROLE_GOOD]
|
||||||
if resistance_roles:
|
if resistance_roles and all(r is not None for r in resistance_roles):
|
||||||
resistance_roles.sort()
|
resistance_roles.sort()
|
||||||
context['resistance_roles'] = resistance_roles
|
context['resistance_roles'] = resistance_roles
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
socket=127.0.0.1:8042
|
socket=127.0.0.1:8042
|
||||||
chdir=/home/anyoneeb/sites/apps/avalon/avalon-django/avalon
|
chdir=/home/anyoneeb/sites/apps/avalon/avalon-django/avalon
|
||||||
plugin=python
|
plugin=python3
|
||||||
module=avalon.wsgi:application
|
module=avalon.wsgi:application
|
||||||
env=DJANGO_SETTINGS_MODULE=avalon.local_settings
|
env=DJANGO_SETTINGS_MODULE=avalon.local_settings
|
||||||
master=True
|
master=True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user