Closed brandon-rhodes closed 8 years ago
I just noticed there's already a 'Vagrantfile' in the repository. Once you have Virtualbox and Vagrant setup do the following:
git clone https://github.com/PyCon/pycon.git && cd pycon
vagrant up
vagrant ssh
virtualenv env/pycon; . env/pycon/bin/activate
pip install --trusted-host dist.pinaxproject.com -r requirements/dev.txt
cp pycon/settings/local.py-example pycon/settings/local.py
./load_fixtures.sh
sudo su - postgres
createuser -dlPs root
psql
GRANT ALL PRIVILEGES ON DATABASE pycon2016 TO root;
./manage.py createsuperuser
./manage.py runserver 0.0.0.0:8000
THANK YOU for putting together this list of steps, @chefscott! This is exactly what I needed to know in order to create a turnkey script.
But I am going to go ahead and re-open this issue because its goal was the creation of a script that would perform the above steps. The goal here is for developers to be able to run one command and then see the PyCon web site running locally. I will work on getting the above steps put together into a turnkey script, and I'll update this issue with my progress.
Thanks again for figuring out how we could get the site running!
Oh — and, in case it helps with any future scripts you write: note that instead of using two commands to become another user as in sudo su - postgres
, you can instead ask sudo
directly to do something as a non-root user. Either of the following works, for example:
$ sudo -u postgres bash
$ sudo -u postgres psql -l
After checking out the repository, @njl reported that there was no quick and easy way to get the PyCon Django site up and running locally on his machine.
In all of the projects I have worked on, it is important to have a quick provisioning script. Whether it uses a virtual machine managed by something like Vagrant, or uses a virtualenv style Python environment that runs natively on a developer's host, such a script lets a developer go from an initial checkout to a working site that they can debug in a single step.
A Vagrant image is tempting here because a Django site like this requires a MySQL database to be up and running, which is difficult to provide in a virtualenv, and almost inevitably will involve a number of manual admin setup steps to install on a developer's Linux, Mac, or Windows machine — but as I am not sure what the Django current best-practice is for turnkey solutions that get both the site and a database for it up and running, we defer to @chefscott the choice of approach here.