Task | Contributors | Running Locally | Deploying To Heroku |
Ever struggled keeping track of which Mac Book each of your employees are holding on to? Do you need a way of tracking when an item changes hands with another? Maybe you're struggling to keep on top of when your leases end? Never fear, SimpleAssetTracker is here!
Providing a barebones yet full experience, this app was built with smaller start-ups in mind - where you don't need a load of fancy-shmancy features.
The team over at SimpleAssetTracker consists of:
-
Ben Lynch
To run this app locally, you'll first need to clone the repository using git clone <repository-link>
We use Postgres as our Database software. You'll need to install Postgres too!
To do so on Mac:
brew install postgres
To do so on Windows: You'll want to download an official release from here
Now that you've done that, we'd advise you to set up an environment for this project. If you don't know how to do that, we can guide you!
Anaconda is a useful environment management tool for projects where you don't want to install packages onto your route.
Thankfully, Anaconda provide a great installation guide here. Please use the COMMAND LINE installer - we've encountered issues with the graphical one!
Once you've finished the installation, you should be able to navigate over to your terminal and run conda -V
with no issues.
To create a new environment, run conda create -n ENV_NAME python=3.8
. This creates a new environment with your name of choice that you can use as a sandbox for python package installation!
You can activate this environment at any time using conda activate ENV_NAME
There are two different package managers being used for this project - pip and npm.
To install packages for pip, make sure you're in the project root and you are within your environment. Then run pip install -r requirements.txt
- this will read the requirements file for packages that are needed. If you run into an error then you might need to update pip by running python -m pip install --upgrade pip
.
To install node packages, navigate into /AssetTracker/apps/reactfrontend
and run npm install
.
To be able to run the tests and app locally, you will also need to set up a .env
file. This is to be located in /AssetTracker/settings
and will need have some secret information, which we can provide if you get in touch. For the DATABASE_URL
you will first need to go to the PSQL command line and create a database for the app. The other information you need is your PSQL username and password, then you put in the .env file as follows:
DATABASE_URL=postgres://USERNAME:PASSWORD@localhost:5432/DB_NAME
Just remember to replace USERNAME, PASSWORD and DB_NAME with your details. Once this is done you can then run the migrations, which is explained in our migrations Wiki.
To run tests you'll need a version of geckodriver installed. Either install it with brew
$ brew install geckodriver
Or download latest release from:
https://github.com/mozilla/geckodriver/releases
To run all tests make sure you are in your root directory before running the following:
$ python manage.py test AssetTracker.apps
To just run the feature (functional) tests then use:
$ python manage.py test AssetTracker.apps.functionaltests
or for just the unit tests then use:
$ python manage.py test AssetTracker.apps.unittests
If you are running the tests multiple times then you'll get a database stacktrace. To prevent this you can just add the --keepdb
flag to the end of the test commands ie
$ python manage.py test AssetTracker.apps --keepdb
This doesn't affect the running of the tests but does make the ouput much cleaner!
Deployment to Heroku can be fast and simple with the proper set-up.