tiistai 16. kesäkuuta 2015

How to join the Django's Cookiecutter-based project and get it up and running in Ubuntu Vagrant?


Django's cookiecutter project template is really nice package of the commonly used best practices. It makes some of the boring stuff which usually consumes few days when you're creating a project.

If you have followed the Speeding up the Vagrant-instructions, you'll get the Cookiecutter project up and runnign by using these instructions.


Install Postgresql & virtualenv
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install python-virtualenv
Create a virtualenv
virtualenv venv

Create your user & the database
sudo su - postgres psql CREATE USER vagrant WITH PASSWORD 'vagrant'; CREATE DATABASE databasename OWNER vagrant; \q
exit

Add your db-details to venv/bin/activate and activate it
export DATABASE_URL=postgres://vagrant:vagrant@localhost:5432/databasename
source venv/bin/activate

Get files from the repository
git clone https://yourusername@repourl.git


Go to your repository and install OS & Python-dependencies

sudo ./install_os_dependencies.sh install
sudo ./install_os_dependencies.sh install

And you're done almost done! Run the last command and see if it works by browsing to 192.168.50.100:8000.
python manage.py runserver_plus 0.0.0.0:8000

4 kommenttia: