Commit e7aa7c7b authored by David Haynes's avatar David Haynes
Browse files

Merge branch 'upgrade-django' into 44-gitlab-ci

parents 4cc472c7 fb9de727
Pipeline #1145 passed with stage
in 21 seconds
...@@ -18,49 +18,56 @@ ...@@ -18,49 +18,56 @@
# (You'll need to reverse proxy port 8000 via nginx) # (You'll need to reverse proxy port 8000 via nginx)
# Set the base image to Ubuntu # Set the base image to Ubuntu
FROM ubuntu:16.04 FROM python:2.7
ENV PYTHONUNBUFFERED 1
# File Author / Maintainer # File Author / Maintainer
MAINTAINER Student-Run Computing and Technology - GMU # MAINTAINER Student-Run Computing and Technology - GMU
# Update the sources list # Update the sources list
RUN apt-get update RUN apt-get update
RUN mkdir /whats_open
WORKDIR /whats_open
ADD /requirements/ /whats_open/
RUN pip install -r base.txt
ADD . /whats_open/
# Install basic applications # Install basic applications
RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential # RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential
# Install Python and Basic Python Tools # # Install Python and Basic Python Tools
RUN apt-get install -y python python-dev python-distribute python-pip # RUN apt-get install -y python python-dev python-distribute python-pip
# Clone down SRCT-Web # # Clone down SRCT-Web
RUN git clone https://github.com/srct/whats-open.git whats-open # RUN git clone https://github.com/srct/whats-open.git whats-open
# Get pip to download and install requirements: # # Get pip to download and install requirements:
RUN pip install -r /whats-open/requirements.txt # RUN pip install -r /whats-open/requirements.txt
# Set this to a unique, secure value before building # # Set this to a unique, secure value before building
# (http://www.miniwebtool.com/django-secret-key-generator/) # # (http://www.miniwebtool.com/django-secret-key-generator/)
ENV SECRET_KEY "" # ENV SECRET_KEY ""
# Set the default directory where CMD will execute # # Set the default directory where CMD will execute
WORKDIR /whats-open/whats_open # WORKDIR /whats-open/whats_open
# Setup database # # Setup database
RUN python manage.py syncdb --noinput # RUN python manage.py syncdb --noinput
RUN python manage.py migrate website --noinput # RUN python manage.py migrate website --noinput
# Generate static files in the STATIC_ROOT location # # Generate static files in the STATIC_ROOT location
# (https://docs.djangoproject.com/en/dev/howto/static-files/deployment/) # # (https://docs.djangoproject.com/en/dev/howto/static-files/deployment/)
RUN python manage.py collectstatic --noinput # RUN python manage.py collectstatic --noinput
# Add any inital data fixtures # # Add any inital data fixtures
# (https://docs.djangoproject.com/en/dev/howto/initial-data/) # # (https://docs.djangoproject.com/en/dev/howto/initial-data/)
ADD fixtures /whats-open/whats_open/ # ADD fixtures /whats-open/whats_open/
# Import the loaded fixtures # # Import the loaded fixtures
RUN python manage.py loaddata users schedules # RUN python manage.py loaddata users schedules
# Expose ports # # Expose ports
EXPOSE 80 # EXPOSE 80
# Use Gunicorn to server the application # # Use Gunicorn to server the application
CMD gunicorn whats_open.wsgi:application -b 0.0.0.0:80 # CMD gunicorn whats_open.wsgi:application -b 0.0.0.0:80
...@@ -18,8 +18,15 @@ section), but sometimes it's the small things that count, so don't be afraid of ...@@ -18,8 +18,15 @@ section), but sometimes it's the small things that count, so don't be afraid of
contributing just for a spelling mistake. contributing just for a spelling mistake.
If you need help at all please contact any SRCT member in the `#whats-open` If you need help at all please contact any SRCT member in the `#whats-open`
channel in our [slack group](https://srct.slack.com). We want people to contribute, so if you are struggling, or just want to channel in our [slack group](https://srct.slack.com). We want people to
learn, then we are willing to help. contribute, so if you are struggling, or just want to learn, then we are
willing to help.
Check out some of the other What's Open projects!
- [https://git.gmu.edu/srct/whats-open-android]()
- [https://git.gmu.edu/srct/whats-open-ios]()
- [https://git.gmu.edu/srct/whats-open-web]()
- [https://git.gmu.edu/srct/whats-open-alexa]()
# Setup instructions for local development # Setup instructions for local development
...@@ -91,7 +98,56 @@ the SRCT code respository with SSH. ...@@ -91,7 +98,56 @@ the SRCT code respository with SSH.
## 3) Get whats-open up and running ## 3) Get whats-open up and running
#### Prerequisites & Required Packages Now that we have `git` setup and cloned down the code you can
cd whats-open/
and get to working on setting up a development environment! There are two options
to go about doing this: `Docker` and `Manual Setup`.
### Docker
We can automate the setup process through [Docker](https://www.docker.com/what-docker)
containers! This allows us to quickly get started and standardize development
environments across machines.
Installing Docker on your system:
- For macOS: [https://docs.docker.com/docker-for-mac/]()
- For Windows: [https://docs.docker.com/docker-for-windows/]()
- For your specific *nix distro: [https://docs.docker.com/engine/installation/]()
Additionally, you will need to install docker-compose: [https://docs.docker.com/compose/install/]()
Next inside the `whats-open/` root directory run:
docker-compose build
If that doesn't work, try:
sudo docker-compose build
Then, follow up with:
docker-compose up
If that doesn't work, try:
sudo docker-compose build
You should see that the server is running by going to [http://localhost:8000]()
in your browser. Any changes you make to your local file system will be mirrored in the server.
If you would like to log into the admin interface then use the following credentials:
```
user: admin@masonlive.gmu.edu
pass: admin
```
### Manual Setup
Manual Setup involves all of the same steps as Docker, but just done manually.
First, install python, pip, and virtualenv on your system. First, install python, pip, and virtualenv on your system.
* `python` is the programming language used for Django, the web framework used by whats-open. * `python` is the programming language used for Django, the web framework used by whats-open.
...@@ -111,7 +167,6 @@ you install `python`, `pip`, and `virtualenv`. ...@@ -111,7 +167,6 @@ you install `python`, `pip`, and `virtualenv`.
Next with, Next with,
cd whats-open/
virtualenv venv virtualenv venv
source venv/bin/activate source venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
...@@ -150,7 +205,6 @@ If you're new to Django and don't know where to start, I highly recommend ...@@ -150,7 +205,6 @@ If you're new to Django and don't know where to start, I highly recommend
giving the [tutorial](https://docs.djangoproject.com/en/dev/intro/tutorial01/) giving the [tutorial](https://docs.djangoproject.com/en/dev/intro/tutorial01/)
a try. However, it leaves out a lot of important things, so remember, Google is a try. However, it leaves out a lot of important things, so remember, Google is
your friend. your friend.
For the JavaScript, I will be using jQuery whenever possible because I prefer For the JavaScript, I will be using jQuery whenever possible because I prefer
it to straight up JavaScript. jQuery has [great it to straight up JavaScript. jQuery has [great
documentation](http://docs.jquery.com/) and I've found [Mozilla's documentation documentation](http://docs.jquery.com/) and I've found [Mozilla's documentation
......
version: '2'
services:
web:
build: .
restart: always
ports:
- '8000:8000'
command: /bin/bash ./startup.sh -python whats_open/manage.py runserver 0.0.0.0:8000
volumes:
- .:/whats_open
environment:
- superuser=admin
- email_domain=@masonlive.gmu.edu
\ No newline at end of file
...@@ -2,3 +2,4 @@ Django>1.10, <1.11 ...@@ -2,3 +2,4 @@ Django>1.10, <1.11
django-autoslug==1.9.3 django-autoslug==1.9.3
django-cas-client==1.2.0 django-cas-client==1.2.0
djangorestframework==3.6.2 djangorestframework==3.6.2
django-model-utils==2.6.1
\ No newline at end of file
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='$superuser$email_domain').delete(); User.objects.create_superuser('$superuser$email_domain', '$superuser', 'admin')" | python whats_open/manage.py shell
python whats_open/manage.py runserver 0.0.0.0:8000
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