GithubHelp home page GithubHelp logo

flipperpa / django-python3-vagrant Goto Github PK

View Code? Open in Web Editor NEW
47.0 8.0 20.0 44 KB

Vagrantfile for a Python/Django VirtualBox VM for Local Development

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%

django-python3-vagrant's Introduction

DEPRECATED! Please read!

This Vagrant box is very out-of-date. There's a slightly less out-of-date Vagrant box with better examples here:

https://github.com/wharton/python-vagrant-centos7/

django-python3-vagrant with FreeTDS for SQL Server 1.1

Ships with Python 3.4, 2.7, and virtualenvwrapper

This is a Vagrant Ubuntu Linux environment created for Python / Django developers. It should be ready to go for Django development use with a core suite of tools, like virtualenv and virtualenvwrapper, defaulted to Python v3.4. Python 2.7 is only included in case you need it.

Also included is an optional install for FreeTDS and unixODBC, which will allow you to connect to Microsoft SQL Server.

Prerequisites

Installation and Login

Fairly easy to get it running: first, checkout the repository to your machine.

git clone https://github.com/FlipperPA/django-python3-vagrant.git
cd django-python3-vagrant && vagrant up

Then, SSH into your new virtual machine:

vagrant ssh

Installing FreeTDS for SQL Server (Optional)

Run the follow commands to install all pre-requesites and put your configuration files in the proper place.

cd /vagrant/examples
./install-mssql.sh

Next, you need to enter your server information, by editing the following two files:

/etc/freetds/freetds.conf
/etc/odbc.ini

Start Your Django Project

Then following instructions will be included each time you SSH into your guest VM. Starting a Django project (/vagrant on the guest VM with be mounted to the directory with the Vagrantfile where you ran "vagrant up" on your local machine: you will be able to edit files on the local machine in this directory, which will automatically appear in /vagrant on the guest VM):

cd /vagrant/projects
mkvirtualenv django_project
pip install django==1.9
django-admin.py startproject django_project
cd django_project
python manage.py runserver 0.0.0.0:8000

You should now be able to see your initial Django site in a browser:

http://localhost:8000/

Hooking Up Django to SQL Server (Optional)

In your virtualenv, install the required Python packages:

pip install pyodbc==3.0.10
pip install django-pyodbc-azure==1.9.0.1

Then, set up your DATABASES setting in your Django settings file:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'HOST': 'dbserver.domain.com',
        'PORT': '1433',
        'NAME': 'dbname',
        'USER': 'dbuser',
        'PASSWORD': 'dbpassword',
        'AUTOCOMMIT': True,
        'OPTIONS': {
            'driver': 'FreeTDS',
            'unicode_results': True,
            'host_is_server': True,
            'extra_params': 'tds_version=7.2',
        },
    },
}

Setting Up Your Hosts File (optional)

If you'd like to view the site in your browser at an address like http://vagrant:8001/, then on your host machine, add the following to the hosts file:

192.168.99.100  vagrant
  • Mac hosts file location: /private/etc/hosts
  • Windows hosts file location: %SystemRoot%\system32\drivers\etc\hosts

New to Django? Here are some excellent resources, check them out, as one size does not fit all for learning:

v1.1

  • Install Pygments and support for colorize cat command, ccat.
  • Install Ubuntu package pre-requesities for Pillow and Wagtail installation.
  • Latest version of pip installed for Python 3.

v1.0

  • Initial release.

Feel free to reach out to me with any questions. - Tim Allen ([email protected])

django-python3-vagrant's People

Contributors

flipperpa avatar vladimir-tikhonov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-python3-vagrant's Issues

Chef Cookbooks Blank

It looks like the subdirectories under the 'cookbooks' directory are all empty. When Chef goes to reference its cookbooks, we get these errors:

[2013-11-19T20:51:23+00:00] WARN: found a directory apache2 in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory apt in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory build-essential in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory emacs in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory git in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory mysql in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory python in the cookbook path, but it contains no cookbook files. skipping.
[2013-11-19T20:51:23+00:00] WARN: found a directory vim in the cookbook path, but it contains no cookbook files. skipping.

Unless I missed something!

On django 1.9, the instructions when ssh-ing into the vagrant box are incorrect

I just tried to follow the instructions that are listed when ssh-ing into the vagrant box or when running 'menu'. During the pip install command, django 1.9 was retrieved. Running django-admin startproject works as expected, however when running manage.py runserver you get an import error:
"No module named django"

To fix, I had to substitute pip install with pip3 install within the virtualenv.

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.