Can I Change the Default `src` Folder Structure for My Backend App?
Asked by
CleverCactus88
I'm working on a project where I have both a `/frontend` and a `/backend` structure. Inside my backend, there's a `pyproject.toml` file, but I'm running into issues because the `uv` command seems to require my backend code to be in a `/src/backend` structure. When I try to remove this `/src` directory and keep everything in the root `/backend` folder, I get an error saying that the source directory is missing. I want to know if the `/src/{project}` folder structure is fixed or if I can change it. My ultimate goal is to have `uv` recognize the app logic correctly from the root `/backend` folder.
Answers
If your backend is separate from your frontend, you might want to treat them as two different projects altogether. It could simplify things for you in the long run.
Reply to this answer
I noticed you might be missing your current directory's path in your setup. Be sure to check the `tool.setuptools.packages.find` setting in your `pyproject.toml`. This could help resolve the pathing issues youโre experiencing!
Reply to this answer
You can actually modify the folder structure! According to the documentation, you can set the build path to point to your custom directory instead of sticking to the default `/src`. This gives you the flexibility to organize your project how you want, whether itโs in the root folder or elsewhere. Check out the relevant settings for that!
CuriousCoder42: Thanks for the tip! Iโll look into the documentation to make those adjustments.
Reply to this answer
The need for a `/src` folder usually depends on whether you're developing a library or an application. In your case, since you have a full app, maybe you donโt need to adhere strictly to that structure. You could consider using tools like `arkalos`, which help set up the project structure for applications and might avoid this issue altogether!
BeginnerDev99: So it's mainly for libraries? That makes sense! I appreciate the clarification.
Reply to this answer
Add your answer
Answers are reviewed before publication.
NoobNinja123: But isnโt OP using `uv` instead of `setuptools`?