Can I Change the Default `src` Folder Structure for My Backend App?

0
4
Asked By CleverCactus88 On

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.

4 Answers

Answered By InquisitiveOtter On

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.

Answered By HelpfulHedgehog123 On

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.

Answered By PackagerPanda On

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!

NoobNinja123 -

But isn’t OP using `uv` instead of `setuptools`?

Answered By LogicalLynx On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.