Is there a way to run a yarn command with python runserver command

Hello i’m integrating Graphql-Mesh into my application for graphql support, however it can only be ran using yarn mesh dev. Is there a way to have that command run alongside python manage.py runserver?

My tech stack is python 3.8

my custom made content management system is here: bastianhilton/Alternate-CMS: Alternate CMS combines the power, extendibility, scalability, and security that Python and Django is known for. While building itself as a headless solution for any business small to enterprise. (github.com)

I have a project that needs to run multiple services locally. Since we haven’t converted to docker or some other containerization, I wrote a script to handle it. It does not work with windows though:

# Run multiple processes in one.
# https://stackoverflow.com/a/52033580/1637351
(trap 'kill 0' SIGINT; source venv/bin/activate && source .env &&  python python/manage.py runserver & source .env && yarn develop)

I would like to know more about this, where and how would you add this to a django project exactly to get it to execute? sorry for the newb question.

I created a bin directory in my project. Then add this code to a file. I called it local.sh. You then have to be able to execute it. sudo chmod a+x bin/local.sh will do that. After that you can run it with bin/local.sh

If you use the file above, you’d have a project like as follows:

- venv
-- bin/
--- activate
--- python
- python/
-- manage.py
-- remainder of python app
- frontend/
-- remainder of frontend app
- package.json

However, that’s a structure that I’m using for one of my projects and may not match yours.

For your own project, take the commands you’d like to run simulatenously, then concatenate them with &&'s between them. Then use

(trap 'kill 0' SIGINT; <your concatenated commands>)

You can put that file anywhere, but when you execute it, you need to do so from the same directory that you would have used with the original commands.

Hopefully that makes sense. Let me know where any confusion is.

If you’d like to know more about how it all works, check out that stack overflow link in the comments.