diff --git a/README.md b/README.md index c90f48c..31f4f25 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ You can either run the project locally or via Github codespaces. Since Github ha 2. Go to the codespaces tab and create a new codespace 3. Everything should set itself up automatically, wait until it says "your application running is available at...". 4. If you want to get back to the codespace after closing it, go to the repository and once again click the green CODE button. It should show up in a list. You can also choose to open the codespace using vscode if you don't like the URL bar at the top or want to connect to the frontend, by clicking the three dots next to the codespace. +5. Move on to "Get the Backend Running" for the next steps. ### Running Locally @@ -24,25 +25,28 @@ You can either run the project locally or via Github codespaces. Since Github ha - `wsl --set-default Ubuntu-22.04` - For more info: [Microsoft documentation](https://learn.microsoft.com/en-us/windows/wsl/install) - -1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/). - - - Windows users: Make sure you select Use WSL 2 instead of Hyper-V if the option is presented. +1. You need docker installed. + - If you're using Windows, install [Docker Desktop](https://www.docker.com/products/docker-desktop/). Make sure you select Use WSL 2 instead of Hyper-V if the option is presented. + - If you're on MacOS or Linux, you want to install the regular Docker CLI. [Here's a Linux guide](https://wiki.archlinux.org/title/Docker), if you're using MacOS you can ask one of the su-permen. You might need to add yourself to the docker group so VSCode can run the docker process as your user instead of root. 1. Open a new VSCode window and install Dev Containers extension from the Extensions menu. 1. Open the Command Palette (`Ctrl + Shift + P` / `Cmd + Shift + P`) and select `Dev Containers: Clone Repository in Container Volume...`. Select `GitHub`, then enter `fsek/WebWebWeb.git`. -1. After configuration has finished in the open terminal, it should say `Done. Press any key to close the terminal`. Open `main.py` and make sure VSCode has selected our Python interpreter from `.venv` folder: In the bottom right corner of VSCode it should say approximately `Python 3.11.2 ('.venv': venv)`. Otherwise, open Command Palette -> `Python: Select Interpreter` and choose `./.venv/bin/python`. +1. After configuration has finished in the open terminal, it should say `Done. Press any key to close the terminal`. + +1. From now on, whenever you want to open this project. Open a new VSCode window and in Recent, find `WebWebWeb in a unique volume [Dev Container]`. Don't re-run `Clone Repository...` from step 3. You can now: + +### Get the Backend Running + +1. Open `main.py` and make sure VSCode has selected our Python interpreter from `.venv` folder: In the bottom right corner of VSCode it should say approximately `Python 3.11.2 ('.venv': venv)`. Otherwise, open Command Palette -> `Python: Select Interpreter` and choose `./.venv/bin/python`. 1. Open a new Bash terminal (`Ctrl + Shift + Ö`) and run `uvicorn main:app --reload`. Terminal should have (.env), otherwise run `source .venv/bin/activate`. 1. Go to http://127.0.0.1:8000/docs for the Swagger page automatically generated by FastAPI 🎉 -1. From now on, whenever you want to open this project: Open a new VSCode window and in Recent, find `WebWebWeb in a unique volume [Dev Container]`. Don't re-run `Clone Repository...` from step 3. - ## Play around -1. Try calling some routes. You will find some routes fail since you are not logged in. Find the "Authorize" button and login using boss@fsektionen.se `dabdab`. +1. Try calling some routes. You will find some routes fail since you are not logged in. Find the "Authorize" button and login using boss@fsektionen.se and `dabdab69`. 1. Call the GET `/users/me` route to view the logged in used. Change your last name to something creative by calling the PATCH `/users/me`. @@ -63,3 +67,4 @@ To add a new package, add a new line in `requirements.txt` specifiying package n +