Nenhuma descrição

Camille Masset 8ba9e9f109 Optimise SQL requests in counter.get view 10 anos atrás
counter 8ba9e9f109 Optimise SQL requests in counter.get view 10 anos atrás
locale b65f417483 Translate individual counter page 10 anos atrás
seum 76a913d614 Refactor hashtag view. Translate hashtag view 10 anos atrás
static 93e9947e0e Adde static files for favicon and robots.txt 10 anos atrás
.gitignore 5abdf257a8 Version migrations 10 anos atrás
LICENSE.txt bbd2a4b152 Added license 10 anos atrás
README.md 1ac30cdeb0 Simplify URLconfs. Add debug toolbar in DEBUG mode 10 anos atrás
deploy.sh 6471d37b9f Modified deploy script 10 anos atrás
fecthLatestDB.sh e98097ccc4 Modified score computing (softer decrease with time) and added helper scripts 10 anos atrás
manage.py 8fc3c05f22 First model for seum counter 10 anos atrás
requirements.txt 1ac30cdeb0 Simplify URLconfs. Add debug toolbar in DEBUG mode 10 anos atrás

README.md

seum-counter

Installation

Clone the repo, then create a virtualenv with Python 3, then install the required packages with :

pip install -r requirements.txt

Then copy and paste the settings file template located in folder seum:

cd seum && cp settings.py.default settings.py

Running the server

Developement

First, comment out the lines below "#Production settings" in settings.py.

You will also need to apply the unapplied migrations:

python manage.py migrate

Then simply use the django command:

python manage.py runserver 0.0.0.0:8000

If you want to use the Django Debug Toolbar, follow the instructions from the https://django-debug-toolbar.readthedocs.io/en/1.6/installation.html.
You just have to edit your settings.py file.

Production

Install the packages needed to run an Apache server with wsgi_mod :

sudo apt-get install apache2 libapache2-mod-wsgi-py3

Then add the following content to the file /etc/apache2/sites-available/000-default.conf, inside the <VirtualHost> tag :

Alias /static <path-to-project-folder>/static
<Directory <path-to-project-folder>/static>
     Require all granted
</Directory>

<Directory <path-to-project-folder>/seum>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess seum python-path=<path-to-project-folder>:<path-to-project-folder>/<name-of-virtualenv>/lib/python3.5/site-packages
WSGIProcessGroup seum
WSGIScriptAlias / <path-to-project-folder>/seum/wsgi.py

To give Apache the permission to serve the files, execute these three commands :

chmod 664 <path-to-project-folder>/db.sqlite3
sudo chown :www-data <path-to-project-folder>/db.sqlite3
sudo chown :www-data <path-to-project-folder>

To launch or restart the server, simply run :

sudo service apache2 restart

Backup data

To backup the database, execute the command

python manage.py dumpdata --exclude contenttypes > seum.json

You can then restore your data into a freshly migrated new database with

python manage.py loaddata seum.json