Git Product home page Git Product logo

djvasa's Introduction

djvasa

https://badge.fury.io/py/djvasa.png https://travis-ci.org/cgallemore/djvasa.png?branch=master https://pypip.in/d/djvasa/badge.png

(Dj)ango - (Va)grant - (Sa)ltStack

In an effort to learn about Vagrant and SaltStack I had the idea to create a tool to help me initialize Django projects more efficiently, this is the result. Djvasa is a command line tool to help you rapidly create a Django project for use with Vagrant. In addition, the Vagrant environment can be provisioned with certain tools typical to a Django project ready for use. The provisioning is handled with SaltStack.

The following guide assumes you already have Vagrant and VirtualBox installed and that you have the salty-vagrant plugin installed. If you have Vagrant and VirtualBox already, but need the plugin, you can install like so:

>> vagrant plugin install vagrant-salt

Quick Start

>> pip install djvasa
>> djvasa --postgres
What's the name of your project? foobar
What's your full name? Chad Gallemore
What's your email? [email protected]

>> cd foobar
>> vagrant up
>> vagrant ssh
>> . .virtualenvs/{{project_name}}/bin/activate && cd /vagrant
>> python manage.py syncdb
>> python manage.py runserver 0.0.0.0:8000
>> Go to http://localhost:8000
>> Prosper...

The above creates your basic Django project and provisions your virtual environment so you can start development. Once you shell into your vagrant environment the motd will provide you instructions on how to activate your virtualenv and run your server.

Options

Currently djvasa provides two database options, mysql or postgres, as well as an option to setup your project for deployment to Heroku. By default the project is initialized for git usage and creates a .gitignore file, but if you wish to use mercurial there is a flag for enabling mercurial

>> djvasa -h
usage: djvasa [-h] [--heroku] [--mysql] [--postgres] [--hg]

optional arguments:
-h, --help  show this help message and exit
--heroku    Initialize the project for deployment to Heroku.
--mysql     Initialize the project with MySQL.
--postgres  Initialize the project with Postgres.
--hg        Initialize project for mercurial.
>> djvasa --mysql

Heroku

Djvasa provides an option to set your project up for deployment to Heroku. Since Heroku uses Postgres as the database, postgres will automatically be enabled for your project. Your settings file will contain the necessary Heroku requirements. Below is an example:

>> djvasa --heroku
What's the name of your project? foobar
What's your full name? Chad Gallemore
What's your email? [email protected]

>> cd foobar
>> git init
>> git add .
>> git ci -m"my django app"
>> heroku create
>> git push heroku master
>> heroku run python manage.py syncdb
>> heroku open

djvasa's People

Contributors

cgallemore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

djvasa's Issues

Flag to not create django project

User already has a django project and all the really want is the vagrant stuff. Should be able to cd into project root and run something like:

djvasa --no-django

And create all the relevant vagrant setup.

Finalize 0.1

  1. License file
  2. Update long description
  3. Go over setup.py and ensure everything is correct.

Add support for heroku

Add a switch from the command line to set the project up for deployment to Heroku

  • Procfile
  • database settings

Create Documentation

Eventually will want to set this up on rtfd, so I need to organize and create some documentation.

Move to using django project templates.

The more I think about it, the better I think it would be to instead of using my own template, it would be better to make it configurable to pass in a project template like:

https://github.com/twoscoops/django-twoscoops-project

I know there are others out there as well, like the one from lincoln loop. By default we could just use the twoscoops one out of the box, buy maybe another cli option to pass in a template name of your choice.

Create a global config

There should be a global config so the user doesn't have to toggle the same options all the time. For example, I'm thinking a .djvasa file in the users home directory:

[djvasa]
email='[email protected]'
full_name='Chad Gallemore
heroku=True

Resolve Heroku Deployment Issue

Created a project initialized for Heroku, and it deployed fine to Heroku, or so it seemed. When I went to run the syncdb command I got an error, something about postgres not running. When I tried to go to /admin got the same error.

Create motd

Create a moth so when uses ssh, they will have a welcome message and some instructions to get them going. Instructions should be based off flags set.

motd:
file.managed:
- name: /etc/motd
- source: salt://motd

Add support for OpenShift

Been meaning to see what it would take to deploy a Django app to OpenShift. Seems as good a time as any.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.