Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/realmteam/django-base-setup
Basic setup for a new django project
https://github.com/realmteam/django-base-setup
boilerplate django
Last synced: about 1 month ago
JSON representation
Basic setup for a new django project
- Host: GitHub
- URL: https://github.com/realmteam/django-base-setup
- Owner: RealmTeam
- Created: 2014-11-29T17:02:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-04-09T12:53:16.000Z (almost 7 years ago)
- Last Synced: 2024-11-06T21:27:00.424Z (3 months ago)
- Topics: boilerplate, django
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
==========================
Django + React boilerplate
==========================This is the basic setup for a new django project.
-------------------------------------------------------------------------------------------------------
****************
Where to start ?
****************Installing the development environment :
========================================Server :
--------Before anything else :
::sudo apt-get install libmysqlclient-dev python-dev python-mysqldb
Install the cache handler :
::sudo apt-get install memcached
Setup the virtualenv :
::virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txtIf you don't have virtualenv or pip :
::sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install virtualenvIf you want to use celery :
::sudo apt-get install redis-server
Front :
-------Before anything else :
::sudo apt-get install nodejs npm
sudo npm install -g yarnInstalling front dependencies :
::cd front && yarn install && cd ..
Running the server :
====================
::source .venv/bin/activate
python manage.py runserverRunning celery :
================
::source .venv/bin/activate
celery --app=main.celery:app worker --loglevel=INFO -BRunning the front :
===================
::source .venv/bin/activate
python manage.py runfront-------------------------------------------------------------------------------------------------------
*************************************
Setting up the production environment
*************************************Before anything else :
======================In the following commands, replace `{{name}}` by the name you want for your site.
You can also run `python manage.py configuredeployment` which will configure
all the files for you and change these commands accordingly.Generating certificate for https :
==================================::
openssl req -new -newkey rsa:2048 -nodes -keyout nginx/ssl/{{name}}.key -out nginx/ssl/{{name}}.csr
openssl x509 -req -days 365 -in nginx/ssl/{{name}}.csr -signkey nginx/ssl/{{name}}.key -out nginx/ssl/{{name}}.crtInstalling docker :
===================::
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
sudo aptitude update
sudo aptitude install lxc-docker
sudo gpasswd -a ${USER} docker
sudo service docker restart
newgrp dockerCreating and running our stack :
================================::
docker-compose up -d
# Alternatively, you can use the DEBUG environment variable to launch in prod or in dev
DEBUG=True docker-compose up -dChecking if the stack is running :
==================================::
docker-compose ps
Get shell access to a container :
=================================::
docker-compose exec api bash
Display the logs from the stack :
=================================::
docker-compose logs -f
Stopping and Destroying the stack :
===================================::
docker-compose down
Stopping the stack :
====================::
docker-compose stop
Starting the stack :
====================::
docker-compose start