Since you made 2 django projects, you should keep them separate as 2 django
projects. Don't merge them into one folder. The right way to do this is to
package your authentication app and import that into the other project. See
this document on making your authentication app as a reusable app:  Advanced
tutorial: How to write reusable apps | Django documentation | Django
(djangoproject.com)
<https://docs.djangoproject.com/en/5.1/intro/reusable-apps/#advanced-tutorial-how-to-write-reusable-apps>

Once it's installed as a django app into the RepairAnything project, you
can then use authentication API into your repairmodule app. And that's how
microservices are usually designed.

On Fri, 11 Oct 2024 at 17:01, shiva singh <shivasingh...@gmail.com> wrote:

> Hello
>   I am currently working on a microservices project using Django and have
> encountered an issue.
>  i am facing issue when create microservice project using django i am
> created 2 difrent django project in one common folder and one project name
> is authentication and second project name is repairmodule and when i access
> authentication project's model class in repairmodule models class and when
> i run makemigrations i am getting this error:
> File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
>   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 1147, in
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
>   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
>   File "<frozen importlib._bootstrap>", line 241, in
> _call_with_frames_removed
>   File "C:\BSInfosys\RepairAnything\repairmodule\repair\models.py", line
> 2, in <module>
>     from authentication.authenticate.models import User, RepairManProfile
> ModuleNotFoundError: No module named 'authentication'
> this is my directory Structure:
> RepairAnything/
> ├── authentication/
> │   ├── manage.py
> │   ├── authentication/
> │   │   ├── __init__.py
> │   │   ├── asgi.py
> │   │   ├── settings.py
> │   │   ├── urls.py
> │   │   ├── wsgi.py
> │   │   └── __pycache__/
> │   └── authenticate/
> │       ├── __init__.py
> │       ├── admin.py
> │       ├── apps.py
> │       ├── migrations/
> │       │   └── __init__.py
> │       ├── models.py
> │       ├── serializers.py
> │       ├── tests.py
> │       ├── urls.py
> │       └── views.py
> ├── env/                   # Your virtual environment
> ├── repairmodule/
> │   ├── manage.py
> │   ├── repair/
> │   │   ├── __init__.py
> │   │   └── models.py
> │   └── repairmodule/
> │       ├── __init__.py
> │       ├── asgi.py
> │       ├── settings.py
> │       ├── urls.py
> │       ├── wsgi.py
> │       └── __pycache__/
> ├── db.sqlite3            # Database file
> ├── .env                  # Environment variables file
> ├── .gitignore            # Git ignore file
> └── README.md             # Project README file
>
> I would appreciate your guidance on how to resolve this issue. If you need
> any additional information, please let me know.
>
> Thank you for your time and assistance!
>
> Best regards,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEsRHMWn1PSmBcD%3Db6jLqYwnCD-FsVtgvKXuAe8kybRo%2BmEQDg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEsRHMWn1PSmBcD%3Db6jLqYwnCD-FsVtgvKXuAe8kybRo%2BmEQDg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Abdul Qoyyuum Bin Haji Abdul Kadir
Nickname: Q
More about me: https://buymeacoffee.com/qoyyuum

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANVqoJ-cvrUAe1aeuTP6iO7WAvO%3Da7u_f25OMMapN2iVWgHY0Q%40mail.gmail.com.

Reply via email to