Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap Django API #419

Merged
merged 1 commit into from
Mar 24, 2022
Merged

Bootstrap Django API #419

merged 1 commit into from
Mar 24, 2022

Conversation

aaronxsu
Copy link
Member

@aaronxsu aaronxsu commented Mar 10, 2022

Overview

This PR:

  • adds django and database services for local dev as API and DB
  • adds/updates ./scripts/bootstrap, ./scripts/setup, ./scripts/update, ./scripts/manage, ./scripts/server, ./scripts/dbshell
  • adds a simple /api/ API route and returns a message that shows the API works as expected
  • adds a small test on the frontend to allow testing the communication with local dev API

Notes

  1. I made some notes as single comments in the files changed below. Feel free to discuss!
  2. I did not add in Vagrant in this solution, and would like to propose to start from just using Docker. If we find it easier to add Vagrant as a layer in between in the future, I'd be happy to take that issue as well.

Testing Instructions

  • Make sure your local docker app is running
  • At the root of the directory, run ./scripts/setup, which should bootstrap the app, install deps, build containers, and run migrations
  • Run ./scripts/server, which should spin up a local DB, frontend, and Django API server
  • After the Django API is up and running, make sure the following is successful
curl --location --request GET 'http://localhost:8081/api'
  • Go to http://localhost:9966, open your network tabs in the dev tools, and filter to the /api/ call. Make sure the request is also successful
  • At the root of the directory, run ./scripts/manage migrate and make sure it runs migrations, although there is no migration to run now, which is fine
    At the root of the directory, run ./scripts/dbshell and make sure it takes you to a local psql shell and you could do normal SQL stuffs there

Resolves #414

backend/Dockerfile Outdated Show resolved Hide resolved
backend/Dockerfile Outdated Show resolved Hide resolved
backend/echo/settings.py Outdated Show resolved Hide resolved
backend/api/views.py Outdated Show resolved Hide resolved
scripts/dbshell Outdated Show resolved Hide resolved
@aaronxsu aaronxsu changed the title [WIP] Bootstrap Django API Bootstrap Django API Mar 16, 2022
README.md Show resolved Hide resolved
backend/echo/settings.py Outdated Show resolved Hide resolved
backend/requirements.txt Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@ddohler ddohler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together! Overall, this looks really good. I found some smaller things that I think need to be addressed, and some larger architecture discussion items that might potentially lead to more work, or to other issues being created. Let me know what you think!

README.md Outdated Show resolved Hide resolved
scripts/server Show resolved Hide resolved
scripts/update Outdated Show resolved Hide resolved
scripts/update Outdated Show resolved Hide resolved
scripts/update Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
scripts/dbshell Outdated Show resolved Hide resolved
backend/api/views.py Outdated Show resolved Hide resolved
backend/api/views.py Outdated Show resolved Hide resolved
backend/echo/settings.py Outdated Show resolved Hide resolved
@aaronxsu aaronxsu requested a review from ddohler March 23, 2022 14:25
Copy link
Contributor

@ddohler ddohler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well! I found a few more things that I think should be changed but it looks like they've all got pretty easy resolutions, so this is good to go after cleaning those up!

README.md Show resolved Hide resolved
backend/api/views.py Outdated Show resolved Hide resolved
taui/src/index.js Outdated Show resolved Hide resolved
scripts/bootstrap Show resolved Hide resolved
backend/Dockerfile Outdated Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
scripts/update Show resolved Hide resolved
taui/src/index.js Outdated Show resolved Hide resolved
taui/package.json Show resolved Hide resolved
- update docker-compose to include django and
  database services
- add STRTA scripts for local development
- bootstrap Django to be used as API backend with
  necessary dependencies, middleware, db config
- update start command in the package.json for frontend
  so that it can proxy the django API locally
- update README for the STRTA section
- update gitignore to ignore byte-compiled python
  files and static files from Django
@aaronxsu aaronxsu force-pushed the feature/asu/add-django branch from 7173c86 to d1d63a3 Compare March 24, 2022 21:11
@aaronxsu aaronxsu merged commit fada714 into develop Mar 24, 2022
@aaronxsu aaronxsu deleted the feature/asu/add-django branch March 24, 2022 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Django to development environment
2 participants