Git Product home page Git Product logo

vagrant-nginx-django's Introduction

Test LEMP Stack for Local Django development

Takes https://github.com/michaelck/puppet-lamp-stack-for-omeka and makes it stupider -- only shell provisioning so far.

Relied on the following online tutorials:

Notes:

  • This setup relies on a few assumptions:
    • uWSGI is pip-installed globally while all other packages are pip-installed into virtualenvs
    • Python3 configuration: echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    • echo "export WORKON_HOME=~/venvs" >> ~/.bashrc
    • echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
    • YOU CANT USE PYTHON 3 unless uwsgi for python 3 installed globally! (hard won knowledge)
    • (maybe try python3 -m pip install uwsgi in bootstrap.sh instead)
  • Remove link to default in etc/nginx/sites-enabled/default
  • Unless specifically configured, Vagrantfile only points traffic from guest port 80 -- so any debugging using other ports won't forward

Steps once vagrant is up:

Configure PostgreSQL

  • createdb <name> & createuser -P
  • psql
  • grant privileges ...
  • you may have to change etc/postgresql/<version>/main/pg_hba.conf to except md5 authentication

Configure virtualenvwrapper + Django project

  • mkvirtualenv --no-site-packages -i django -i psycopg2 -i django-bootstrap3 -p python3 <project>
  • cd /srv/apps/<project> & django-admin.py startproject <project> [existing path]
  • mkdir /srv/apps/<project>/static
  • settings.py
    • 17:STATIC_ROOT=os.path.join(BASE_DIR,'static')
    • not all INSTALLED_APPS necessary -- delete any before running migrate
    • change DATABASE settings:
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': '<db>',
        'USER': '<user>',
        'PASSWORD': '<pw>',
        'HOST': 'localhost',
        'PORT': '',
  • ./manage.py migrate
  • ./manage.py collectstatic
  • if using ./manage.py runserver don't forget 0.0.0.0:8000 (quirk of how 127.0.0.1 "loops back" -- or something)

FONTS

vagrant-nginx-django's People

Contributors

bulbil avatar

Stargazers

Evgeny avatar

Watchers

James Cloos avatar

Forkers

swarthmore

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.