Bloq is a blog project written to learn Django myself. The blog engine is licensed under GNU General Public License v3 and it is open source project.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
What things you need to install the software and how to install them
- Python 3.x
- Django (newest version)
- Python PIP
- virtualenv or better virtualenvwrapper
- Linux (not tested on BSD and Windows, I hope it will works)
A step by step series of examples that tell you have to get a development env running
Create virtual environment and activate it:
mkvirtualenv -p /usr/bin/python3 bloq_site
workon bloq_site
Clone project from GitHub:
git clone https://github.com/hubotx/django_bloq.git
cd django_bloq
Install all needed dependencies:
pip install -r requirements.txt
And finally run Django server:
python manage.py runserver
First, create virtual environment and install project in ~/django_projects/django_bloq
.
Create .env file in ~/django_projects/django_bloq/django_blog
folder with following settings:
SECRET_KEY='your_secret_key'
DEBUG=False
ALLOWED_HOSTS='example.com','www.example.com'
SECURE_SSL_REDIRECT=True
CSRF_COOKIE_SECURE=True
SECURE_BROWSER_XSS_FILTER=True
SECURE_CONTENT_TYPE_NOSNIFF=True
SESSION_COOKIE_SECURE=True
X_FRAME_OPTIONS='DENY'
SECURE_HSTS_SECONDS=3600
SECURE_HSTS_INCLUDE_SUBDOMAINS=True
SECURE_HSTS_PRELOAD=True
Ensure chmod-socket
is 666 in ~/django_projects/django_bloq/config/uwsgi-pro.ini
to avoid permission errors.
Export static resources in Django:
$ python manage.py collectstatic
Next, create nginx configuration file in /etc/nginx/sites-available/example.com
with following content:
upstream django {
server unix:///tmp/django_bloq.sock;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
return 302 https://$server_name$request_uri;
}
server {
# SSL configuration
#
listen 443 ssl http2;
listen [::]:443 ssl http2;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
include snippets/letsencrypt.conf;
include snippets/ssl-params.conf;
server_name example.com www.example.com;
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass django;
}
location /static/ {
alias /home/user/django_projects/django_bloq/static/;
}
location /media/ {
alias /home/user/django_projects/django_bloq/media/;
}
}
Run uwsgi worker:
$ uwsgi --ini config/uwsgi-pro.ini
Create symbolic links:
$ sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com
Reload nginx:
$ sudo service nginx reload
- Django - The web framework used
- PIP - Dependency Management
- Python 3.x - Backend programming language
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the GNU General Public License v3 - see the LICENSE file for details