|
|
# Organising our files
|
|
|
|
|
|
You are doing great and as we'll soon see, the possibilities are out of bounds.
|
|
|
|
|
|
But first let's make sure we are all on the same page.
|
|
|
|
|
|
Run `git checkout -f Step-1` everyone should now be at the same PTF level...
|
|
|
|
|
|
## Time for some action, just a fraction of friction
|
|
|
|
|
|
If your not used to working in a bash shell, this might seem overly complicated,\
|
|
|
and if you've never used vim before, it might be downright terrifying!
|
|
|
|
|
|
The branch you just pulled will try and alleviate it the pain, taking us from grit 80 sandpaper to (hopefully) very little friction.
|
|
|
|
|
|
Try and list the folder content, by typing `ls -la` ...
|
|
|
|
|
|
You'll note a lot of new files have appeared, of note are:
|
|
|
|
|
|
* _requirements.txt_\
|
|
|
This file lists the packages our project requires, and their expected version.\
|
|
|
So instead of pip installing everything, we'll run simply run `pip install -r requirements.txt` and it will install what ever is needed.\
|
|
|
You can create this fill, by getting pip to list all dependencies in your project, and saving it to the requirements file.\
|
|
|
Simply run `pip freeze >requirements.txt`
|
|
|
* _start.sh_\
|
|
|
Going forward, we don't want to bother with all this installing, running, backgrounding and stopping nonsense.\
|
|
|
The bash shell-script `start.sh` will handle all the pain.\
|
|
|
If there is no virtual environment, it will create it, install the required packages (using the above file),\
|
|
|
test if the FastAPI service is running, and depending on what is required start or restart it.
|
|
|
* _stop.sh_\
|
|
|
The bash shell-script `stop.sh` will stop the service if it is running, it is used by `start.sh`, and in general we should have to worry about it.
|
|
|
* _view.sh_\
|
|
|
Running the service in the background is nice, but if we ever want to inspect what the service is doing `view.sh` will display the log of the service
|
|
|
* _.vimrc_\
|
|
|
Finally, we've added some configuration to vim, to make things a little more enjoyable here as well.\
|
|
|
First up, line-numbers and syntax highlighting, which should improve on legibility\
|
|
|
Second, we've bound **F5** to the `start.sh` script, so now updating packages and restarting the service is as simple as pressing **F5**.
|
|
|
|
|
|
## Before we start adding stuff, lets introduce some timestamps, everyone loves timestamps! |
|
|
\ No newline at end of file |