{"id":16420378,"url":"https://github.com/philgyford/vagrant-heroku-cedar-16-python","last_synced_at":"2026-04-30T12:32:28.089Z","repository":{"id":66746641,"uuid":"101206881","full_name":"philgyford/vagrant-heroku-cedar-16-python","owner":"philgyford","description":"A Vagrant box for python/Django development, mimicking a Heroku cedar-16 dyno.","archived":false,"fork":false,"pushed_at":"2018-03-09T17:39:14.000Z","size":16,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T16:17:15.812Z","etag":null,"topics":["django","django-development","heroku","vagrant"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philgyford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-23T17:22:39.000Z","updated_at":"2017-09-01T06:09:19.000Z","dependencies_parsed_at":"2023-03-11T00:19:51.693Z","dependency_job_id":null,"html_url":"https://github.com/philgyford/vagrant-heroku-cedar-16-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/philgyford/vagrant-heroku-cedar-16-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philgyford%2Fvagrant-heroku-cedar-16-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philgyford%2Fvagrant-heroku-cedar-16-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philgyford%2Fvagrant-heroku-cedar-16-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philgyford%2Fvagrant-heroku-cedar-16-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philgyford","download_url":"https://codeload.github.com/philgyford/vagrant-heroku-cedar-16-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philgyford%2Fvagrant-heroku-cedar-16-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32465009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-development","heroku","vagrant"],"created_at":"2024-10-11T07:27:51.474Z","updated_at":"2026-04-30T12:32:28.082Z","avatar_url":"https://github.com/philgyford.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vagrant Heroku cedar-16 box for Python and Django\n\nA Vagrant box for python/Django development, mimicking a Heroku cedar-16 dyno. Based on the older [cedar-14 version](https://github.com/philgyford/vagrant-heroku-cedar-14-python).\n\n* Ubuntu 16.04 (bento/ubuntu-16.04)\n* PostgreSQL 9.6\n* Python 2.7, 3.5 or 3.6\n* pip, virtualenv, virtualenvwrapper\n* Requirements for the python image processing module Pillow\n* foreman (optional, and sometimes problematic; see below)\n* GeoDjango requirements (optionally)\n\nIf a `requirements.txt` file is found, packages in it will be installed into the virtualenv. (The filename can be configured, see below.)\n\nWhen you ssh into the VM the virtualenv will automatically be activated.\n\nIf a `Procfile` is found, and the `start_foreman` setting is `'true'`, foreman\nwill be started. (The Procfile filename can be configured, see below.)\n\nThe project directory (containing the `Vagrantfile`) will be availble in the VM at `/vagrant/`.\n\nIf there's a `manage.py` file in the root of the project, it will be used to run Django's `migrate` (optional) and `collectstatic` commands.\n\n\n## Running it\n\n1. Install [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/).\n\n2. In your project, make a `config/` directory, if it doesn't already have one.\n\n3. Make a copy of `config/vagrant.template.yml` and put it at `config/vagrant.yml` in *your* project.\n\n4. If you have a Procfile, and want foreman to run, you *must* change the Django `settings_module` in `config/vagrant.yml` to whatever you want the `DJANGO_SETTINGS_MODULE` environment variable in the virtual machine to be. Feel free to change any of the other config options if appropriate.\n\n    You can also change the name of the Procfile foreman should use in `config/vagrant.yml`, in case you want to use a different one in Vagrant versus production (see below).\n\n5. Either copy, move or symlink `Vagrantfile` and the `config/vagrant/` directory into your Django project. So it will be something like:\n\n        config/\n            vagrant/            # a copy or symlink\n                bash_setup.sh\n                ...\n            vagrant.yml\n        myproject/\n            ...\n        manage.py\n        Procfile\n        requirements.txt\n        runtime.txt             # optional, see below\n        Vagrantfile             # a copy or symlink\n\n    This will vary slightly depending on your Django project's layout.\n\n6. Run `vagrant up` from the same directory that the copy/symlink of `Vagrantfile` is in.\n\n7. Go to [http://localhost:5000](http://localhost:5000) or [http://0.0.0.0:5000](http://0.0.0.0:5000) in your browser.\n\nIf you change or update any of the Vagrant stuff, then do `vagrant provision` to have it run through and update the box with changes.\n\n### Subsequently\n\nIf you `vagrant halt` the box, you'll need to do `vagrant up --provision` to get everything running again. Just doing `vagrant up` won't currently start foreman etc.\n\n## Configuring\n\nEdit the `config/vagrant.yml` file to change the following settings:\n\n### `db`\n\n`name`, `user` and `password` will be used to for the Postgres database name, and to create a database user. These should be the same as in your Django settings file.\n\n### `django`\n\n`settings_module`: Specify the dotted path to the Django settings module. e.g. `myproject.settings.development` will use the settings file at `myproject/settings/development.py`.\n\n`run_migrations`: This should be `'true'` if you want the Django migrations to\nbe run. If you're going to import an existing database dump (see below) you\nshould set this to `'false'` (or anything other than `'true'`).\n\n### `foreman`\n\n`procfile`: As described above, if you want to use a specific Procfile for use in the Vagrant VM, set its name here. e.g. `Procfile.dev`.\n\n`start_foreman`: This should be `'true'` to use foreman to run the webserver.\nSet it to `'false'` (or anything other than `'true'`) if you want to use the\nDjango `runserver` command manually (see below).\n\n### `virtualbox`\n\n`name`: This will be the name of the box as seen in the Virtualbox UI.\n\n`memory`: How much RAM should the virtual machine have in MB? e.g. `'1024'`.\n\n### `virtualenv`\n\n`envname`: This will be used to create a python virtualenv in which all the project's requirements, and python version, will be installed. e.g. `myvirtualenv` will result in a virtualenv being created at `/home/vagrant/.virtualenvs/myvirtualenv/`.\n\n`requirements_file`: Specify the name of the pip requirements file to use when setting up the virtualenv. e.g. `requirements_dev.txt`.\n\n### `use_geodjango`\n\nSet this to `'true'` if you want to install the necessary packages for GeoDjango. See below.\n\n\n## Foreman or the Django development server?\n\nBy default foreman sends output to stdout and stderr. This prevents Vagrant from exiting nicely, even though we run foreman as `foreman .. \u0026`. To ensure a smooth exit from foreman, and to be able to see its output in future, you should send the output of processes in your Procfile to a file. eg:\n\n    web: gunicorn --reload --log-level debug myproject.wsgi \u003e /home/vagrant/gunicorn.log 2\u003e\u00261\n\nThen you can just `tail -f /home/vagrant/gunicorn.log` to see its output. For this reason you might want to use a different Procfile for use in Vagrant than you do with your live server (use the setting in `config/vagrant.yml` to specify the filename).\n\nAlso note: We use the `--reload` option with gunicorn so that it reloads when code changes. Otherwise you'll never see changes when you make them!\n\n**However:** This still [seems to get stuck](http://stackoverflow.com/questions/38208840/restart-gunicorn-run-with-foreman-on-error) sometimes, with gunicorn's log showing \"Worker failed to boot\". To avoid using foreman at all then set the `start_foreman` setting to `'false'`, then you can run the Django dev server manually:\n\n    $ vagrant ssh\n    vagrant$ /vagrant/manage.py runserver 0.0.0.0:5000\n\n\n## Python versions\n\nBy default the virtualenv will use python 2.7.\n\nTo specify python 3.6 [Heroku requires you](https://devcenter.heroku.com/articles/python-runtimes) to place a `runtime.txt` file in your repository's root containing one line:\n\n    python-3.6.2\n\nWhen setting up the Vagrant box, if this file is present, and contains `python-3.6*`, then python 3.6 will be installed and used for the virtualenv. It will do similar for `python-3.5*`, although Heroku don't support this on Cedar 16.\n\n\n## GeoDjango\n\nIf you want to use GeoDjango, set the ``use_geodjango`` variable in your `config/vagrant.yml` file to the string ``true``:\n\n    use_geodjango: 'true'\n\nThis will install the requirements for using GeoDjango: GEOS, PROJ.4, GDAL, PostGIS.\n\n### Note\n\nThe install script should do this, but I had an occasion when I was getting this error while running Django migrations:\n\n\tdjango.db.utils.ProgrammingError: permission denied to create extension \"postgis\"\n\nSo I had to do this (replace `DB_NAME` with your database name):\n\t\n\t$ vagrant ssh\n\tvagrant$ sudo -u postgres psql DB_NAME\n\t=# CREATE EXTENSION postgis;\n\t=# \\q\n\n\n## Database\n\nTo change the version of Postgres (and PostGIS, if you're using GeoDjango), edit the variable(s) in `config/vagrant/postgresql_setup.sh`.\n\nThe process above will set up a postgres database and user, and run Django migrations, but not populate the database. Database name, username and password are set in `config/vagrant.yml`.\n\nIf you have a `pg_dump` dump file, put it in the same directory as your Django project and then:\n\n    $ vagrant ssh\n    vagrant$ cd /vagrant\n    vagrant$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U your_pg_username -d your_db_name your-dump-name.dump\n\nYou'll be prompted for the postgres user's password, and then it should import.\n\nNOTE: You might get errors when importing due to the database tables existing.\nIf you want to undo all those Django migrations, and delete all the tables, this\nseems to work (use at your own risk):\n\n\t$ vagrant ssh\n\tvagrant$ psql -U your_pg_username -h localhost -d your_db_name\n\t=\u003e select 'drop table \"' || tablename || '\" cascade;' from pg_tables where schemaname = 'public';\n\t=\u003e \\q\n\nThen you can do the `pg_restore`.\n\n\n## Environment variables\n\nThe simplest way to set up environment variables in the virtual environment is to put a `.env` file in the root of of your project (i.e., the same level as `requirements.txt`, `config/`, etc.).\n\nIf present, this file will be symlinked in the VM to the virtual environment's `postactivate` hook, so it will be run whenever the environment is activated. An example file:\n\n    #!/bin/bash\n\n    export MY_ENVIRONMENT_VARIABLE=hello-there\n    export MY_OTHER_VAR=\"Hello there\"\n\n\n## Virtualenvwrapper\n\nIf you need more control over the virtual environment than setting environment variables (above), then you can do the following. NOTE: doing this *and* using a `.env` file is probably a bad idea.\n\nTo use virtualenvwrapper's [user-defined hooks](http://virtualenvwrapper.readthedocs.org/en/latest/scripts.html#scripts) then create a directory at `config/virtualenvwrapper/vagrant/` containing them. For example, continuing our example structure above:\n\n        config/\n            vagrant/        # a copy or symlink\n            vagrant.yml\n            virtualenvwrapper/\n                vagrant/\n                    postactivate\n                    postdeactivate\n                    preactivate\n        ...\n\nIf this directory is present, the `VIRTUALENVWRAPPER_HOOK_DIR` environment variable will be set, and these files will be used instead of the defaults.\n\nSo, to set environment variables for your virtualenv you might add something like this to your `postactivate` file:\n\n    #!/bin/bash\n    # This hook is run after this virtualenv is activated.\n\n    export MY_ENVIRONMENT_VARIABLE=hello-there\n    export MY_OTHER_VAR=\"Hello there\"\n\nThese files are only created on initial set-up, so to change their contents subsequently, do it manually. They can be found in the vagrant box at `/home/vagrant/.virtualenvs/your-venv-name/bin/`.\n\n\n## Potential problems\n\nIf you try to access your Django site in a browser but get a \"Peer authentication failed for user\" error, then ensure you've set the `HOST` value in your Django settings file to `localhost` or (*for development only*) `\"*\"`. An empty string will not work.\n\n\n## Useful / Inspired by:\n\n* https://github.com/kiere/vagrant-heroku-cedar-14/\n* https://github.com/ejholmes/vagrant-heroku/\n* https://github.com/torchbox/vagrant-django-base/\n* https://github.com/torchbox/vagrant-django-template\n* https://github.com/jackdb/pg-app-dev-vm/\n* https://github.com/maigfrga/django-vagrant-chef/\n* https://devcenter.heroku.com/articles/cedar-ubuntu-packages\n\n\n## Credits\n\n* [Phil Gyford](https://github.com/philgyford) - Initial creation\n* [Steven Day](https://github.com/stevenday) - [cedar-14](https://github.com/philgyford/vagrant-heroku-cedar-14-python) v1.1 updates and fixes\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilgyford%2Fvagrant-heroku-cedar-16-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilgyford%2Fvagrant-heroku-cedar-16-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilgyford%2Fvagrant-heroku-cedar-16-python/lists"}