Skip to content

TBP-IT/tbpweb-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tbpweb

TBP CA-A website rework, build in Django

Setup

Vagrant will automatically setup a virtual machine with the correct setup for developing hknweb.

Install Vagrant and VirtualBox It is okay to install the latest of both (and mostly recommended)! Otherwise, consult with another Officer who has the setup working and first try to match the VirtualBox version and then the Vagrant version.

In one point in time, there have been some issues in the past with other versions of Virtual Box in terms of compatibility of Vagrant. You can find those here VirtualBox Old 6.0 Builds, and at the time, Virtual Box 6.0.14 was recommended

Fork the tbpweb repository and clone your fork to your local machine

Open terminal, and cd into the cloned directory (if on Windows, be sure to run Command Prompt instead, as administrator). Check to make sure there is a Vagrantfile in the directory. If on Windows, also run VirtualBox as admin. Then, from the cloned directory in terminal, type

$ vagrant up

which will download and boot a Linux virtual machine, then run setup.

To access the environment, run

$ vagrant ssh

which will ssh your terminal into the virtual machine.

See Development for how to run the Django web server.

From here, run

$ cd tbpweb

Developing on tbpweb requires a virtual environment so that every developer has the exact same development environment i.e. any errors that a developer has is not due to difference in configuration. We will be using Python's built-on venv to make our virtual environment. This command creates our virtual environment.

$ make venv

Next, we need to have our current terminal/shell use the virtual environment we just created. We do this through:

$ source .venv/bin/activate

To install all dependencies (including django), run

$ make install

There 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 migrate

If you would like to access the admin interface, create a superuser using the command

$ make superuser

Finally, to run the web instance, simply run the command

$ make run

This 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

$ exit

The same command can be used to exit out of the virtual machine ssh connection.

To turn off the virtual machine, run

$ vagrant halt

which will attempt to safely shutdown the virtual machine, or kill it otherwise.

About

TBP CA-A website rework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 56.5%
  • HTML 29.1%
  • JavaScript 7.6%
  • SCSS 3.5%
  • CSS 1.7%
  • Less 0.8%
  • Other 0.8%