reactivated icon indicating copy to clipboard operation
reactivated copied to clipboard

manage.py build fails after adding Reactivated to existing project

Open chiyc opened this issue 2 years ago • 1 comments

Hi, thanks for this project! I'm new to Django, but the connection between Reactivated templates and React is really intuitive. I've been following the documentation to add Reactivated to an existing project and had some trouble when trying to build the assets manually.

manage.py runserver works to build all of the frontend code on startup, but I was trying to manually run the following build steps for a production deployment with Daphne.

  • manage.py generate_client_assets (worked as expected)
  • manage.py build (didn't work, fails at the tsc --noemit step)

I narrowed the problem down to needing a tsconfig.json in the BASE_DIR, which is present when creating a fresh Reactivated project with the automated scripts. If this is the correct approach, I'm happy to submit a PR for a documentation update to note that users of existing projects need to also add a tsconfig.json.

What do you think about automated approaches such as an initialization script in the npm package that will add the default files necessary? The PyPI package could also have its own script to generate Django specific files. I'm imagining it could lead the user through prompts to make sure there are no existing conflicts.

chiyc avatar Aug 11 '22 12:08 chiyc

Good find! This has happened before, see here: https://github.com/silviogutierrez/reactivated/pull/171#issuecomment-1098252338

I never got around to documenting it!

Definitely interested in automating the required files. In fact, that's a plan for the "nix" managed way. That way, when you upgrade reactivated, you can easily also get the "latest" Dockerfile, scripts/fix.sh, etc.

I wonder if we can also do this for "unmanaged" installs, like yours. How do we know what file you manage — say you brought your own tsconfig? Maybe keep it simple and only create files if they don't exist.

A PR for the docs would be a great start though.

silviogutierrez avatar Aug 11 '22 18:08 silviogutierrez

Closing the issue since this documentation update solved the immediate gap.

chiyc avatar Apr 16 '23 13:04 chiyc