dont use github for emojis now stored in project, will helpp with ssl
34
README.org
|
@ -3,20 +3,28 @@
|
||||||
* Maidstone Hackspace website
|
* Maidstone Hackspace website
|
||||||
[[https://pyup.io/repos/github/maidstone-hackspace/maidstone-hackspace-website/][https://pyup.io/repos/github/maidstone-hackspace/maidstone-hackspace-website/shield.svg]]
|
[[https://pyup.io/repos/github/maidstone-hackspace/maidstone-hackspace-website/][https://pyup.io/repos/github/maidstone-hackspace/maidstone-hackspace-website/shield.svg]]
|
||||||
|
|
||||||
Repository for the maidstone hackspace website
|
Repository for the maidstone hackspace website, feel free to fork this site for your own Hackspace.
|
||||||
|
|
||||||
|
|
||||||
** Requirements
|
** Requirements
|
||||||
Before getting started make sure you have git, docker and docker-compose installed on your machine.
|
Before getting started make sure you have git, docker and docker-compose installed on your machine.
|
||||||
The simplest way to setup this site is to use docker-compose so please install that from this site https://docs.docker.com/engine/installation/ and make sure the quick start guide works https://docs.docker.com/machine/get-started/ then you can use the commands below to test and make changes.
|
The simplest way to setup this site is to use docker-compose so please install that from this site
|
||||||
|
https://docs.docker.com/engine/installation/
|
||||||
|
and make sure the quick start guide works
|
||||||
|
https://docs.docker.com/machine/get-started/
|
||||||
|
then you can use the commands below to test and make changes.
|
||||||
|
|
||||||
** Setup
|
** Setup
|
||||||
To get started checkout the project to your machine.
|
Steps to get the site running for the first time
|
||||||
|
|
||||||
|
*** First clone the project
|
||||||
|
To get started checkout the project to your machine, with the command below.
|
||||||
|
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
git clone https://github.com/olymk2/maidstone-hackspace.git
|
git clone https://github.com/maidstone-hackspace/maidstone-hackspace-website.git
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Build your containers to install the sites requirements
|
||||||
Once checked out build your containers locally you only need to do this when first start or if requirements change.
|
Once checked out build your containers locally you only need to do this when first start or if requirements change.
|
||||||
|
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
|
@ -32,20 +40,22 @@ docker-compose -fdev up
|
||||||
Test django is serving pages
|
Test django is serving pages
|
||||||
http://127.0.0.1:8180
|
http://127.0.0.1:8180
|
||||||
|
|
||||||
|
*** Run migrations to setup the database
|
||||||
*** Run migrations and setup admin user
|
|
||||||
To run django commands just prefix them with =docker-compose -f dev.yml run django=
|
To run django commands just prefix them with =docker-compose -f dev.yml run django=
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
docker-compose -f dev.yml run django python manage.py makemigrations
|
docker-compose -f dev.yml run --rm django python manage.py makemigrations
|
||||||
docker-compose -f dev.yml run django python manage.py migrate
|
docker-compose -f dev.yml run --rm django python manage.py migrate
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
*** Create the admin user.
|
||||||
Creating an admin user
|
Once created you can login at http://127.0.0.1:8180/admin
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
docker-compose -f dev.yml run django python manage.py createsuperuser
|
docker-compose -f dev.yml run --rm django python manage.py createsuperuser
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Generate dummy data
|
||||||
|
#+BEGIN_SRC sh
|
||||||
|
docker-compose -f dev.yml run --rm django python manage.py generate_test_data
|
||||||
|
#+END_SRC
|
||||||
** Migrations / Managing default data
|
** Migrations / Managing default data
|
||||||
If you want to export some data you entered into the admin area you can use =dumpdata= and =loaddata= to export and import.
|
If you want to export some data you entered into the admin area you can use =dumpdata= and =loaddata= to export and import.
|
||||||
|
|
||||||
|
|
|
@ -201,8 +201,10 @@ MEDIA_ROOT = str(APPS_DIR('media'))
|
||||||
import time
|
import time
|
||||||
DRACEDITOR_UPLOAD_PATH = 'images/uploads/{}'.format(time.strftime("%Y/%m/%d/"))
|
DRACEDITOR_UPLOAD_PATH = 'images/uploads/{}'.format(time.strftime("%Y/%m/%d/"))
|
||||||
DRACEDITOR_UPLOAD_URL = '/api/uploader/' # change to local uploader
|
DRACEDITOR_UPLOAD_URL = '/api/uploader/' # change to local uploader
|
||||||
|
DRACEDITOR_MARKDOWN_BASE_EMOJI_URL = '/static/images/emojis/'
|
||||||
MAX_IMAGE_UPLOAD_SIZE = 5242880 # 5MB
|
MAX_IMAGE_UPLOAD_SIZE = 5242880 # 5MB
|
||||||
|
|
||||||
|
|
||||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
from autofixture import AutoFixture
|
||||||
|
from autofixture.generators import ImageGenerator
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.core.management import call_command
|
||||||
|
from mhackspace.base.models import BannerImage
|
||||||
|
from mhackspace.feeds.models import Article, Feed
|
||||||
|
from mhackspace.users.models import User
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = 'Build test data for development environment'
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
try:
|
||||||
|
# python2
|
||||||
|
from urllib import urlretrieve
|
||||||
|
except ImportError:
|
||||||
|
# python3
|
||||||
|
from urllib.request import urlretrieve
|
||||||
|
|
||||||
|
from draceditor.extensions.emoji import EMOJIS
|
||||||
|
|
||||||
|
emoji_path = 'mhackspace/static/images/emojis/' # create this folder first
|
||||||
|
base_url = 'https://assets-cdn.github.com/images/icons/emoji/'
|
||||||
|
|
||||||
|
for emoji in EMOJIS:
|
||||||
|
emoji_image = emoji.replace(':', '') + '.png'
|
||||||
|
|
||||||
|
urlretrieve(base_url + emoji_image, emoji_path + emoji_image)
|
||||||
|
print("Downloaded: {}".format(emoji_image))
|
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 917 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 4.6 KiB |