Skip to content

Commit 13a9030

Browse files
Merge pull request #1 from stanfordnmbl/update-latest
Updated with latest changes.
2 parents 42e7399 + 00629e1 commit 13a9030

37 files changed

+1958
-259
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
data

.github/workflows/deploy.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deploy to EC2
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: SSH into EC2 and deploy
18+
uses: appleboy/ssh-action@master
19+
with:
20+
host: ${{ secrets.EC2_HOST }}
21+
username: ${{ secrets.EC2_USERNAME }}
22+
key: ${{ secrets.EC2_SSH_KEY }}
23+
script: |
24+
cd motionlab
25+
git pull
26+
make run

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
__pycache__
2+
db.sqlite3
3+
*.pyc
4+
*~
5+
\#*
6+
.env
7+
sendgrid.env
8+
keys
9+
.idea
10+
inputs
11+
*.log
12+
node_modules

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ ENV DJANGO_SETTINGS_MODULE=motionlab.settings
5656
# Call collectstatic (customize the following line with the minimal environment variables needed for manage.py to run):
5757
# RUN DATABASE_URL='' python manage.py collectstatic --noinput
5858

59-
RUN mkdir data ; python manage.py migrate ; python manage.py loaddata fixtures/startup-data.json
59+
RUN mkdir data ; python manage.py migrate ;
60+
# python manage.py loaddata fixtures/startup-data.json
6061

6162
# Tell uWSGI where to find your wsgi file (change this):
6263
ENV UWSGI_WSGI_FILE=motionlab/wsgi.py

Makefile

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ push:
88

99
.PHONY: stop
1010
stop:
11-
docker kill motionlab_openpose 2> /dev/null
12-
docker rm motionlab_openpose 2> /dev/null
11+
if [ -n "$$(docker ps -q -f name=motionlab_openpose)" ]; then \
12+
docker kill motionlab_openpose 2> /dev/null; \
13+
fi
14+
if [ -n "$$(docker ps -aq -f name=motionlab_openpose)" ]; then \
15+
docker rm motionlab_openpose 2> /dev/null; \
16+
fi
1317
docker-compose down
1418

1519
.PHONY: start
1620
start:
1721
docker-compose up -d
18-
# -v $(pwd)/.env:/code/.env
19-
docker run --name motionlab_openpose --link motionlab_redis_1:redis --link motionlab_www_1:www --net motionlab_default --gpus all -d --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 stanfordnmbl/motionlab-worker /bin/sh -c 'celery -A worker worker --loglevel=info --concurrency=1 --pool=solo'
22+
# -v $(pwd)/.env:/code/.env
23+
docker run --name motionlab_openpose --link motionlab_redis_1:redis --link motionlab_www_1:www --net motionlab_default -d --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 stanfordnmbl/motionlab-worker /bin/sh -c 'celery -A worker worker --loglevel=info --concurrency=1 --pool=solo'
2024

2125
run: docker stop start

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
The platform is developped in django so it can be deployed as any other django application
88

9-
1. Install requirements with
9+
1. Install requirements with:
1010
```
1111
pip install -r requirements.txt
1212
```
1313
2. Check settings in `motionlab/settings.py`. In particular, make sure to configure it to run on your database and AWS S3 servers.
14-
3. Migrate the database with
14+
3. Migrate the database with (you may need to manually create a folder called "data" to store the local database):
1515
```
1616
python manage.py migrate
1717
```
18-
4. Start the server with
18+
4. Start the server with:
1919
```
2020
python manage.py runserver
2121
```

motionlab/__init__.py

+16
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,19 @@
55
from .celery import app as celery_app
66

77
__all__ = ('celery_app',)
8+
9+
# app/__init__.py
10+
from django.template.defaultfilters import register
11+
12+
# Import your custom filter
13+
from motionlab.templatetags.custom_filters import get_slugs, index, num_processed, get_json_value
14+
15+
# Register the custom filter
16+
register.filter('get_slugs', get_slugs)
17+
# Register the custom filter
18+
register.filter('index', index)
19+
# Register the custom filter
20+
register.filter('num_processed', num_processed)
21+
# Register the custom filter
22+
register.filter('get_json_value', get_json_value)
23+

motionlab/converters.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django.urls import converters
2+
3+
class SlugsConverter:
4+
regex = r'[-\w]+(?:,[-\w]+)*'
5+
6+
def to_python(self, value):
7+
return value.split(',')
8+
9+
def to_url(self, value):
10+
return ','.join(value)

motionlab/forms.py

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from django import forms
55
from django.utils.safestring import mark_safe
66
from django.forms import ModelForm, FileInput
7+
from captcha.fields import CaptchaField
8+
import uuid
79

810
class VideoForm(ModelForm):
911
# terms_confirmed = forms.BooleanField(label=mark_safe("I've read and accept <a href='#license'>the terms of use</a>."))
@@ -15,10 +17,20 @@ class Meta:
1517
# 'file': FileInput(attrs={'class': "dropzone"}),
1618
}
1719

20+
21+
class MultipleVideosForm(ModelForm):
22+
class Meta:
23+
model = Video
24+
fields = ["file", "recordid"]
25+
widgets = {
26+
"file": forms.FileInput(attrs={'multiple': True}) # Add 'multiple' attribute to the widget
27+
}
28+
1829
class ContactForm(forms.Form):
1930
your_email = forms.EmailField(required=True)
2031
subject = forms.CharField(required=True)
2132
message = forms.CharField(widget=forms.Textarea(attrs={'style': 'min-height: 7em;'}), required=True)
33+
# captcha = CaptchaField()
2234

2335
class ApplicationForm(forms.Form):
2436
your_name = forms.CharField(required=True)

motionlab/settings.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
SECRET_KEY = 'ieq1!ik0pt*j)pag5o%%(iy$jn!bj6iwe!x$-3pf5$va+cs#45'
2525

2626
# SECURITY WARNING: don't run with debug turned on in production!
27-
DEBUG = True #False
27+
DEBUG = False
2828

2929
ALLOWED_HOSTS = ['*']
3030

@@ -39,6 +39,7 @@
3939
'django.contrib.sessions',
4040
'django.contrib.messages',
4141
'django.contrib.staticfiles',
42+
'captcha',
4243
'motionlab',
4344
'randomslugfield',
4445
# 'corsheaders',
@@ -107,6 +108,12 @@
107108
},
108109
]
109110

111+
# Max file size.
112+
# Set FILE_UPLOAD_MAX_MEMORY_SIZE to 1 GB
113+
FILE_UPLOAD_MAX_MEMORY_SIZE = 1 * 1024 * 1024 * 1024 # 51 GB
114+
115+
# Set DATA_UPLOAD_MAX_MEMORY_SIZE to 1 GB
116+
DATA_UPLOAD_MAX_MEMORY_SIZE = 1 * 1024 * 1024 * 1024 # 1 GB
110117

111118
# Internationalization
112119
# https://docs.djangoproject.com/en/3.0/topics/i18n/

motionlab/static/images/favicon.png

37.9 KB
Loading

motionlab/static/images/logo.png

80.6 KB
Loading

motionlab/static/images/sit2stand.gif

9.8 MB
Loading

0 commit comments

Comments
 (0)