TBP CA-A website rework, build in Django
Vagrant will automatically setup a virtual machine with the correct
setup for developing hknweb.
Install Vagrant and VirtualBox Make sure you install Virtual Box 6.0.14, as Vagrant is not compatible with newer versions of Virtual Box.
Fork the tbpweb repository and clone your fork to your local machine
Open terminal, and cd into the cloned directory. Check to make sure there is a Vagrantfile in the directory. From there, type
$ vagrant upwhich will download and boot a Linux virtual machine, then run setup.
To access the environment, run
$ vagrant sshwhich will ssh your terminal into the virtual machine.
See Development for how to run the Django web server.
From here, run
$ cd tbpwebMake sure pipenv is installed in your virtual machine. To do this, run
$ pip3 install pipenvNext, make sure there is a Pipfile in your current directory and run
$ pipenv shellTo install django, run
$ pipenv install djangoThere may be warnings that installation of some packages failed, but as long as you can run the command below successfully you are good to go.
If you make any Django changes (to the database models, for instance) you will have to create and migrate migrations. You can do so with the command below. If there were changes to database models made by other developers and you pulled those changes, you just have to run make migrate.
$ make migrations
$ make migrateIf you would like to access the admin interface, create a superuser using the command
$ make superuserFinally, to run the web instance, simply run the command
$ make runThis will start the development server at http://0.0.0.0:3000/. If you go into your web browser and access localhost:3000, you should be able to see the site now!
To access the admin site, access http://0.0.0.0:3000/admin. Use the credentials you created for your superuser to login.
To exit out of the pipenv shell, run
$ exitThe same command can be used to exit out of the virtual machine ssh connection.
To turn off the virtual machine, run
$ vagrant haltwhich will attempt to safely shutdown the virtual machine, or kill it otherwise.