-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canonical location for local apps #881
Comments
As I understand it you should not create your app with startapp command. If you want new app
Into your
and in
And you can start code your app. It works perfectly for me. |
Just extending @Sgiath answer, make sure include
|
Thanks @chrisleaman I forgot that. I'm using PyCharm and it creates this file automatically. |
The canonical place is inside the the project folder, otherwise the root folder gets littered with too much stuff. You can use Where I agree with @Sgiath is his mention ensuring that you have In any case, I'll find a place in the docs to put a more detailed description of how to add apps to a Cookiecutter Django project. |
I fact |
@pydanny when you say When I used the command without specifying a directory (e.g.
|
@Sgiath i have a question |
@kodeine honestly I am not sure 😄 Django can definitely find the config automatically. I guess Users app is just some special case or just preference of the author. |
|
I was getting an error telling me that the app i was trying to use didn't have an explicit app_label even tho it did, I resolved the issue by instead of doing from .models import Product, I now do Product = apps.get_model('product', 'Product') |
Not to jump on an old thread, but no one seemed to address @wasabigeek's comment. If run via docker-compose for
The comments here suggest supplying
Creating it then results in
which conflicts because I've created a directory within |
Have you tried the below? I think I recall the path needs to be the parent path where the app will be created... (master)]$ docker-compose -f local.yml run --rm django python manage.py startapp someapp ./someproject/ https://docs.djangoproject.com/en/2.0/ref/django-admin/#startapp
|
I've just been struggling with this myself, I had the same issue as @ltankey, tried @browniebroke suggestion but it created the files in the project folder. The only way I could create an app using docker-compose was to log in to a shell and create it from within the project folder.
|
Yikes - that works thanks @carlosfunk Sucks that's the only way. |
It's a shame "startapp" does not modify the But that's a Django limitation. |
Cookiecutter-django defines apps inside project folder, i.e.: red_dwarf/red_dwarf/users. I tried following the convention, but Django complains that it can't find my module, e.g.:
config/settings/common.py
ImportError: No module named 'posts'
I'd have to adjust
sys.path
to include the APPS_DIR, but then Django complains, burns, and crashes withModel class [...] doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
So my question is, what is the recommended location for local apps? I've red the docs back to back, gh issues, and the internets but could not find a meaningful answer.
The text was updated successfully, but these errors were encountered: