Hey everyone first time fullstack noob here, novice python, JS and CSS/HTML dev in the middle of development for a Fullstack Django React Native app, the thing is I made a mess out of my modules and nodes trying to compile with 95 no module found error on the expo CLI, I started with npm and the tried yarn since it was recommended and I ended up with a sorry mess. So since the Django backend API is already running on the messy project I’m going for the new project copy paste old code approach, the front end also has components and screens that may need a few touches but the bulk is already there. I not sure about the proper order and want to make extra sure I have the appropriate folder/project creation order so the compiling and installation is as streamlined as possible as well as the creation of the venv; on the last project I had two that had hardcoded the paths for the django folder and the frontend one since I had some issues with my project finding the appropriate folder, so that’s the right approach? at which time during the creation of the projects should the venv creation happen or more precisely which project should be created first with its corresponding venv, Django or React Native Expo, since as far as I understand there’s an ideal order that will create and setup some specs automatically. Any help is greatly appreciated! Thanks

  • anotherlemmyuser
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Hello, I just came across this post while searching on lemmy, I hope you don’t mind my late comment on this post, so I can contribute to Lemmy. I have read your post multiple times, but if it’s not the answer you’re looking for, then I apologise in advance.

    Messed up node modules, because I used npm and yarn

    Delete node modules and do npm i or npm ci or yarn add.

    Order

    I usually do venv first, then I do Django backend, then React Native Expo frontend. However, the order itself isn’t that important, because the frontend and backend folders are separated. Doing backend then frontend is just more convenient since API is used.

    For example, you deploy Django first then you compile Expo and you will see your API fetches. If you decide to do Expo first then Django it is still fine, just when you open your Expo app, you won’t see your API stuff from Django until you deploy Django.

    A heads up that it’s a separate story if you use Docker, which I think you aren’t, since Docker is not mentioned.

    Path

    • I use .env file for React Native

    REACT_APP_API_URL = ‘http://127.0.0.1:8000

    • I use relative paths (src, import) in Django and React Native

    ‘./relative-folder/relative-photo.jpg’

    • I use dynamic path in Django

    os.path.join

    It is generally advised not to use hardcoded paths, try to avoid if possible because whilst it works when you are developing locally, using hardcoded paths may not work during deployment. For Expo using hardcoded paths should still work.