Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django: Is it possible to build filtered drop down menus?
I was wondering if it was possible to build two dropdown menus where the second has options dependent on what is selected in the first one? I have three classes, in the field 'step' in RouteStep is a series of processes, for example Heat Treatment and Removal. I'd like if one of these processes is selected, only fields from 'step_option' associated with that process shows up, similar to a dropdown where selecting a car manufacturer and only getting their models. Is this possible in django forms? class Step(models.Model): name = models.CharField(_('Step Name'), max_length=100, default='') def __unicode__ (self): return self.name class StepOption(models.Model): step = models.ForeignKey(Step, related_name = 'Step', null = True) name = models.CharField(_('Step Option'), max_length=100, default='') def __unicode__ (self): return self.name + " - " + self.step.name class RouteStep(models.Model): step_number = models.PositiveIntegerField(_('Step Number'), default = 0) step = models.ForeignKey(Step, related_name = 'Step+', null = True) step_option = models.ForeignKey(StepOption, related_name = 'StepOption', null=True) def __unicode__ (self): return self.step_option -
Why shouldnt i load STATIC_ROOT when production?
In this guide: https://www.youtube.com/watch?v=M-4xmVk6xrg&list=PLEsfXFp6DpzRcd-q4vR5qAgOZUuz8041S&index=18 Pass to 2:40 When he does: if setting.DEBUG: ... here his code I didnt undersatood well the guy. He do somthing and then say that i shoukd not do that in production. Why? What are the sifference between production and develop situation when use this things and import them to the urlpatterns?? -
Apscheduler is executing job multiple times
I have a django application running with uwsgi (with 10 workers) + ngnix. I am using apscheduler for scheduling purpose. Whenever i schedule a job it is being executed multiple times. From these answers ans1, ans2 i got to know this is because the scheduler is started in each worker of uwsgi. I did conditional initializing of the scheduler by binding it to a socket as suggested in this answer and also by keeping a status in the db, so that only one instance of scheduler will be started, but still the same problem exists and also sometimes when creating a job the scheduler is found not running and the job keeps pending and not executed. I am initializing apscheduler in urls of the django application with following code. This will start the scheduler when application starts. def job_listener(ev): print('event',ev) job_defaults = { 'coalesce': True, 'max_instances': 1 } scheduler = BackgroundScheduler(job_defaults=job_defaults, timezone=TIME_ZONE, daemon=False) scheduler.add_jobstore(MongoDBJobStore(client=client), 'default') scheduler.add_executor(ThreadPoolExecutor(), 'default') scheduler.add_executor(ProcessPoolExecutor(),'processpool') scheduler.add_listener(job_listener) def initialize_scheduler(): try: if scheduler_db_conn.find_one(): print('scheduler already running') return True scheduler.start() scheduler_db_conn.save({'status': True}) print('---------------scheduler started --------------->') return True except: return False I use following code to create the job. from scheduler_conf import scheduler def create_job(arg_list): try: print('scheduler status-->',scheduler.running) job = scheduler.add_job(**arg_list) … -
Django App - Server error when accessing tables in Admin
So I've had a live application running for 8 months now. This app is used for exchanging textbooks between students. The relevant db tables are textbooks, postings, wishlists, users, and log entries. I use facebook login and each time a user logs in they get an ID which has been incremented by one up until 465 but the most recent user got id 498 for some reason. Also, this user added some textbooks so log entries were created. The Id's for these log entries all shot up instead of being incremented. So, one I am confused about why this happened and two when I try to access the posting and wishlist tables I get a server error. Both these tables have foreign keys to user and textbooks. The textbooks table is accessible however. This is all on the admin page. Does anyone know why this might happen? -
Referring to children of recursive ManyToManyField in Django
How do I refer to the children in a ManyToManyField referring to a subclass of itself as follows? class Base(models.Model): parent_A = models.ManyToManyField('A') parent_B = models.ManyToManyField('B') def get_parents_count(self): return self.parent_A.count() + self.parent_B.count() def get_children_count(self): return self.parent_A_set.count() + self.parent_B_set.count() class A(Base): pass class B(Base): pass Here the get_parents_count works, but get_children_count fails with AttributeError 'A' object has no attribute 'parents_A_set' I tried moving the method to the subclasses but without any improvement. I also tried adding pprint(dir(self)) to the get_children_count but without anything looking like the list of children. -
failed with error code 1 when installing django-auth-ldap
I am trying to use django-auth-ldap so first of course I need to install it. I tried to just do pip install django-auth-ldap and that gives me the following problem: C:\Users\hansong.li\AppData\Local\Programs\Python\Python35-32\Scripts>pip install django-auth-ldap Collecting django-auth-ldap Using cached django_auth_ldap-1.2.8-py3-none-any.whl Collecting pyldap (from django-auth-ldap) Using cached pyldap-2.4.25.1.tar.gz Requirement already satisfied (use --upgrade to upgrade): django in c:\users\hansong.li\appdata\local\programs\python\python35-32\lib\site-packages (from django-auth-ldap) Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\users\hansong.li\appdata\local\programs\python\python35-32\lib\site-packages (from pyldap->django-auth-ldap) Installing collected packages: pyldap, django-auth-ldap Running setup.py install for pyldap ... error Complete output from command c:\users\hansong.li\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\hansong.li\\AppData\\Local\\Temp\\pip-build-bak9l5f6\\pyldap\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\hansong.li\AppData\Local\Temp\pip-z6tq2vvb-record\install-record.txt --single-version-externally-managed --compile: defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R extra_compile_args: extra_objects: include_dirs: /usr/include /usr/include/sasl /usr/local/include /usr/local/include/sasl library_dirs: /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 libs: ldap_r running install running build running build_py file Lib\ldap.py (for module ldap) not found file Lib\ldap\controls.py (for module ldap.controls) not found file Lib\ldap\extop.py (for module ldap.extop) not found file Lib\ldap\schema.py (for module ldap.schema) not found creating build\lib.win32-3.5 copying Lib\ldapurl.py -> build\lib.win32-3.5 copying Lib\ldif.py -> build\lib.win32-3.5 copying Lib\dsml.py -> build\lib.win32-3.5 creating build\lib.win32-3.5\ldap copying Lib\ldap\__init__.py -> build\lib.win32-3.5\ldap copying Lib\ldap\async.py -> build\lib.win32-3.5\ldap copying Lib\ldap\compat.py -> build\lib.win32-3.5\ldap creating build\lib.win32-3.5\ldap\controls copying Lib\ldap\controls\__init__.py -> build\lib.win32-3.5\ldap\controls copying Lib\ldap\controls\deref.py -> build\lib.win32-3.5\ldap\controls copying Lib\ldap\controls\libldap.py -> build\lib.win32-3.5\ldap\controls copying Lib\ldap\controls\openldap.py -> build\lib.win32-3.5\ldap\controls copying … -
Django - format date filter values
Referring to this old thread Use a dropdown instead of list?. How do i format any date attribute used in the answer offered by beholderrk. PS. I'm using v1.8 -
Preselective dynamic modelChoicefields Django
I have 3 models, which are connected by Foreign Key like this models.py class Partner(models.Model): partner_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) ... class Product(models.Model): product_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) partner_id = models.ForeignKey(Partner) ... class ProductData(models.Model): data_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) partner_id = models.ForeignKey(Partner) product_id = models.ForeignKey(Partner) ... What I want is a form ProductDataForm, which adjust my choices for product_id by selection one partner_id. I had this forms.py above, but it doesn#t work :( forms.py class ProductDataForm(ModelForm): partner_id = forms.ModelChoiceField(queryset=Partner.objects.all()) product_id = forms.ModelChoiceField(queryset=Product.objects.filter(partner_id=partner_id) I need to work with this dynamic for normal Users and Admins on Homeage and Adminsite. Can someone help me? :) -
Serialise a model instance in django python with all foreign keys/relations in just one json object
I am going to make changes to specific objects in my database. Before I do that, I want to store ONLY those objects separately so that if anything goes wrong, I can just restore them to their original status. In order to achieve this, I am trying to serialize the model instances into json objects. However, I am not able to add the values of the related foreign keys to the same json object. Any idea how to do this? I have tried the django.core.serializers module which only gives the select_related() function but this does not give me the original model instance's values. I also tried django preserialize. I could not figure out how to get all the data (from foreign keys/relations) into just 1 json. I would really appreciate any help on this! -
what do $ and _ mean in javascript?
function ($, _){ ... function _snackbar(content, options) { options = _.extend({ timeout: 3000 }, options); options.content = content; $.snackbar(options); } ... } source from https://thinkster.io/django-angularjs-tutorial#rendering-post-objects It looks like that "_" and "$" are some parameters, I googled and noticed that underscore and jquery are related to these symbols. Could anyone kindly explain that what '_' and '$' stand for, how they make sense and why they are needed here? Thanks a lot. -
I keep getting The below errors on my log file whenever i try to Push my django app to Heroku, Kindly assist on how i should go about in solving it,
Here is my log file $ python manage.py collectstatic --noinput Traceback (most recent call last): File "manage.py", line 9, in <module> execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute django.setup() File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate app_config.ready() File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready self.module.autodiscover() File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover autodiscover_modules('admin', register_to=site) File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules import_module('%s.%s' % (app_config.name, module_to_search)) File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/app/.heroku/python/lib/python2.7/site-packages/registration/admin.py", line 2, in <module> from django.contrib.sites.models import RequestSite ImportError: cannot import name RequestSite ! Error while running '$ python manage.py collectstatic --noinput'. See traceback above for details. You may need to update application code to resolve this error. Or, you can disable collectstatic for this application: $ heroku config:set DISABLE_COLLECTSTATIC=1 https://devcenter.heroku.com/articles/django-assets ! Push rejected, failed to compile Python app. ! Push failed -
Django Migrations: run_before vs dependencies
I always thought that dependencies made sure that all the migrations that I put there ran before the migraton I was declaring. However, today I found about run_before and Im not sure what are the differences between both. Can someon clarify the difference between run_before and dependencies when declaring a Django migration? class Migration(migrations.Migration): dependencies = [ ('myapp', '0123_the_previous_migration'), ] run_before = [ ('third_party_app', '0001_do_awesome'), ] -
How to integrate 3rd party app's urls into my url structure?
I want to use 3rd party app such as imagestore. Default imagestore url config works like site.com/gallery/(album, image, tag). I want to change urls to site.com/username/(album, image, tag) (i.e., remove gallery), but do not know how to do it, because there is namespace='imagestore', which imagestore uses internaly. # core urls urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='base.html'), name="home"), url(r'^gallery/', include('imagestore.urls', namespace='imagestore')), url(r'^(?P<user_url>[\w.-]+)/', include('profiles.urls', namespace='profiles_username')), ] # profiles.urls from . import views urlpatterns = [ url(r'^$', views.profiles_home, name='profiles_home'), ] # piece of imagestore urls urlpatterns = [ url(r'^$', AlbumListView.as_view(), name='index'), url(r'^album/add/$', CreateAlbum.as_view(), name='create-album'), url(r'^album/(?P<album_id>\d+)/$', ImageListView.as_view(), name='album'), url(r'^album/(?P<pk>\d+)/edit/$', UpdateAlbum.as_view(), name='update-album'), url(r'^album/(?P<pk>\d+)/delete/$', DeleteAlbum.as_view(), name='delete-album'), url(r'^tag/(?P<tag>[^/]+)/$', ImageListView.as_view(), name='tag'), ] As I understand, I need somehow to remove url(r'^gallery/', include('imagestore.urls', namespace='imagestore')),, add to profiles.urls such part as include('imagestore.urls'), but at the same time somehow to keep namespace='imagestore'. -
Command error makemigrations in a Python/Django project
Python: 2.7 Django: 1.6 I'm using virtualenv to manage my projects. I have my app added to INSTALLED_APPS. Tryed to run the following command: (pythonenv-1.6)xxxxx@xxxx.com python manage.py makemigrations Unknown command: 'makemigrations' Type 'manage.py help' for usage. I've tryed the python manage.py makemigrations my_app_name and didn't work too. :( -
Two different ajax urls return the same data
I am using jQuery ajax calls on my django site to populate the options in a select box which gets presented in a modal window that pops up (bootstrap) to the user. Specifically, it provides a list of available schemas in a particular database. The ajax url is dynamic which means it includes a db_host and a db_name in the URL. I have a site with clients and each client has to point to a different host/db. The db_host and db_name passed via the URL are used in the django view to execute the necessary sql statement on the relevant host/db. So, the URL should be unique for each db_host/db_name combination. I am running into a problem where I am on client A's page, I click the button to display the modal. The ajax call is made. I get the data I expect. Everything is fine. Let's say the ajax URL is "/ajax/db_host/server_a/db_name/client_a_db/schema_dropdown". Now, I got to client B's page and click the same button to display the modal. The ajax call is made. Let's say this time, the ajax URL is "/ajax/db_host/server_b/db_name/client_b_db/schema_dropdown." However, the data returned is the actually the data that was returned for the previous ajax call … -
"Incorrect string value" when try to save model in Latvian translation
I have a model with TranslatedFields powered by hvad: translations = TranslatedFields( name=models.CharField(max_length=255), short=RedactorField(blank=True, null=True), description=RedactorField(blank=True, null=True), product_text=RedactorField(blank=True, null=True), pricelist=RedactorField(blank=True, null=True), meta_title=models.CharField(max_length=255, null=True, blank=True), meta_keywords=models.CharField(max_length=255,null=True, blank=True), meta_description=models.TextField(max_length=255, null=True, blank=True) ) They are configurated for 3 languages: LANGUAGE_CODE = 'lv' DEFAULT_LANGUAGE = 1 LANGUAGES = [ ('lv', u'Latvijas'), ('ru', u'Русский'), ('en', u'English'), ] Russian and English work just fine, but when I try to save Latvian fields, I get: (1366, "Incorrect string value: '\xC5\xBDET s...' for column 'object_repr' at row 1") What can cause this problem? -
how to build drop down list in django
Dear Helpers, I am trying to build a drop down list in django. I have searched a lot and could not find that could be helpful for me. I want a list like given below in html format but I want to make it using django'choicefield. I read a few posts on stackoverflow.com as well as other sites but did not got what I am looking for. Excuse me for my english and thanks for help in advance. I want make an online attendance system in django like as :- <select name="employee" > <option value="Amandeep">Amandeep</option> <option value="Gagan">Gagan</option> <option value="Gurjeet">Gurjeet</option> <option value="Rajinder">Rajinder</option> </select> -
SMTPAuthenticationError - django
I already visit that web-page: Django SMTPAuthenticationError And i down the "securty captcha" and the "Less secure apps" and still - its giving me that messege: SMTPAuthenticationError at /showname/ Here is my view code: def SignUp(request): form2 = EmailForm(request.POST) if form2.is_valid(): send_mail( form2.cleaned_data['subject'], 'fffffffffffffwdvedfvedfved', form2.cleaned_data['from_email'], ['michael.michaelbuzorgi@gmail.com'], fail_silently=False, ) what can i do else to availabe the option of sending mails? -
How to echo environment variables in Docker
My docker-compose.yml is: version: '2' volumes: postgres_data: {} postgres_backup: {} services: postgres: build: ./compose/postgres volumes: - postgres_data:/var/lib/postgresql/data - postgres_backup:/backups env_file: .env django: build: context: . dockerfile: ./compose/django/Dockerfile user: django depends_on: - postgres - redis command: /gunicorn.sh env_file: .env nginx: build: ./compose/nginx depends_on: - django ports: - "0.0.0.0:80:80" redis: image: redis:latest restart: always And in my .env file, I have: # PostgreSQL POSTGRES_PASSWORD=mysecretpass POSTGRES_USER=postgresuser How do I test if the environment variables are effectively set? I've tried: docker run sorbetcitron_django echo $POSTGRES_USER where sorbetcitron_django is my django image, but it outputs nothing. -
Using django ORM in my celery app giving error
I am developing a celery standalone application which uses Django ORM to access my database and perform operations in my data. I followed the answer to this question: Use Django ORM as standalone But when I run my celery worker, it gives me the following error: django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. Here is my full application code and directory structure: standAlone/ ----init.py ----settings.py DATABASE_ENGINE = "django.db.backends.mysql" DATABASE_NAME = "my_database_name" DATABASE_USER = "my_database_username" DATABASE_PASSWORD = "my_database_password" DATABASE_HOST = "my_host" DATABASE_PORT = "3306", INSTALLED_APPS = ("myApp") ----manage.py #!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myApp.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that the # issue is really that Django is missing to avoid masking other # exceptions on Python 2. try: import django except ImportError: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) raise execute_from_command_line(sys.argv) ----tasks.py import django django.setup() from celery import Celery from django.conf import settings settings.configure( … -
throttling based on authentication class
in DRF docs there is a page about throttling api requests, I wanted to create a custom throttle class, to make something like twitter api (in twitter api direct user/passwords can make less requests/min compared to oauth requests) my problem is how to find out which authentication class was used in current request? -
Detect if Django function is running in a celery worker
I have a post_save hook that triggers a task to run in celery. The task also updates the model, which causes the post_save hook to run. The catch is I do not want to .delay() the call in this instance, I just want to run it synchronously because it's already being run in a worker. Is there an environmental variable or something else I can use to detect when the code is being run in celery? -
Django REST custom authentication
Here's my issue guys. I have a store user that can log to his site and view all kinds of data related to his store. In his store he has, let's say 10 android billing devices that send bills to him. Now I need to create a custom authentication in Django REST framework that will authenticate android devices with their id_number and type fields (not store user's username & password) and assign a token to them (each individually) and allow them to POST, GET, PUT etc.. Is that possible? Store(models.Model): user = models.ForeignKey(User, default=1) AndroidDevice(models.Model): id_number = models.CharField() type = models.CharField() store= models.ForeignKey(Store) -
linux group is not accepting more than 23 users
linux group is not accepting more than 21 users I am creating 23 users for the same group (ex:group1) . After 21 users it is not allowing to create user. adduser -u 1023 -s /bin/sh -G group1 user22 adduser: unknown group group1 Although group exists in "/etc/group" cat /etc/group root:x:0: nogroup:x:65534: ftp:x:55: cortina:x:50: sshd:x:22: admin:x:1000: group1:x:1002:shiva1,shiva2,shiva3,shiva4,shiva5,shiva6,shiva7,shiva8,shiva9,shiva10,shiva11,shiva12,shiva13,shiva14,shiva15,shiva16,shiva17,user18,shiva19,shiva20,shiva21 root@shiva:~# cat /etc/passwd root:p9y5REkVRfJZE:0:0:root:/root:/bin/ash lp:x:4:7:lp:/var/spool/lpd:/bin/sh nobody:x:65535:65535:nobody:/nonexist:/bin/sh mysql:$1$$RmyPVMlhpXjJj8iv4w.Ul.:6000:6000:Linux User,,,:/home/mysql:/bin/sh daemon:$1$$RmyPVMlhpXjJj8iv4w.Ul.:7000:7000:Linux User,,,:/home/daemon:/bin/sh ftp:x:55:55:ftp:/home/ftp:/bin/ash cortina:x:50:50:cortina:/home/cortina:/bin/ash sshd:x:22:22:sshd:/var/empty/.sshd:/bin/false guest:!:65534:100::/home/guest: admin:!:1000:1000::/home/admin: shiva1:$1$Nn0WAgD8$2t9JvsqfCLGCNlF45VoD70:1002:1002:Linux User,,,:/home/shiva1:/bin/sh shiva2:$1$ZB8IVjwD$.Gt8MVEMKX9O4IoFVLnls.:1003:1002:Linux User,,,:/home/shiva2:/bin/sh shiva3:$1$ZadjOvwX$rOlZXqNJWDRurZMCPyebm.:1004:1002:Linux User,,,:/home/shiva3:/bin/sh shiva4:$1$Y/WP/tSp$Mxr3I4rK/QUUCvYX7IeBy.:1005:1002:Linux User,,,:/home/shiva4:/bin/sh shiva5:$1$ZMbaCHw9$WW2r3/kM5k9Frj1MHmVhf.:1006:1002:Linux User,,,:/home/shiva5:/bin/sh shiva6:$1$BjnIFkVw$0mwDt6N4VfOKlRf7pRABJ/:1007:1002:Linux User,,,:/home/shiva6:/bin/sh shiva7:$1$TjSP8V3t$BB6B/ZUUogVt0FzewOMda/:1008:1002:Linux User,,,:/home/shiva7:/bin/sh shiva8:$1$s8DYuPVk$pU2hk/qlFW2OOJh/wu/TQ.:1009:1002:Linux User,,,:/home/shiva8:/bin/sh shiva9:$1$3Xx3Vhhs$U1FtNQO/4UaMEp5ViMsSX.:1010:1002:Linux User,,,:/home/shiva9:/bin/sh shiva10:$1$4u0Fh5AD$B1qN1NPXmY5qBSB0UgaWp.:1011:1002:Linux User,,,:/home/shiva10:/bin/sh shiva11:$1$iEDzlYkz$WiOVK0u38moXP0fpYg9tn.:1012:1002:Linux User,,,:/home/shiva11:/bin/sh shiva12:$1$kZutEBhM$1.CBE.kOK808S4opOaJZT.:1013:1002:Linux User,,,:/home/shiva12:/bin/sh shiva13:$1$lwz2QbAj$saX9MYe0JLs6IUBh75X4s.:1014:1002:Linux User,,,:/home/shiva13:/bin/sh shiva14:$1$AIwgmyYf$XSwc4yiYbBAC9xX./u14V0:1015:1002:Linux User,,,:/home/shiva14:/bin/sh shiva15:$1$NgeCNEkn$Zkj41dIK2vUBtv2IYGfKr1:1016:1002:Linux User,,,:/home/shiva15:/bin/sh shiva16:$1$o1cqjb6k$lcYFuvt7KHqpm/.RYejJu0:1017:1002:Linux User,,,:/home/shiva16:/bin/sh shiva17:$1$pOh/v/b4$hjfrBJgm83W3SP/32yNCk0:1018:1002:Linux User,,,:/home/shiva17:/bin/sh user18:$1$pn9RpBbO$zwfGZCHBgkaIKi5C0IHo..:1019:1002:Linux User,,,:/home/user18:/bin/sh shiva19:$1$pAesiNbi$sw8ykYFSq9bG1VfgLgvg51:1020:1002:Linux User,,,:/home/shiva19:/bin/sh shiva20:$1$pZ7IcZb0$/JjbA4vlBz5bge1yYLuaM1:1021:1002:Linux User,,,:/home/shiva20:/bin/sh shiva21:$1$qwCToz3N$dG9551RVPH/bNe7kxdQvh.:1022:1002:Linux User,,,:/home/shiva21:/bin/sh Is there any linux limitations ? -
Migrating Django-machina models-django unable to locate app
I'm trying to make a forum to my django website using the machina framework. And I've modified the forum_member app as per the documentation (https://django-machina.readthedocs.io/en/stable/customization/recipes/overriding_models.html). And my dir structure is as follows: project has the main apps and manage.py. Inside this project folder, there is another folder called apps which contains machina's overwritten apps. folder\<project apps> folder\manage.py folder\forumapps.pth folder\apps folder\apps\__init__.py folder\apps\forum_member folder\apps\forum_member\__init__.py folder\apps\forum_member\models.py folder\apps\forum_member\migrations folder\apps\forum_member\migrations\<migrations files copied from the original forum_member in machina installation in python>Lib>site-packages> My settings.py: INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'payments', 'social.apps.django_app.default', 'mptt', 'haystack', 'widget_tweaks', 'pagedown', 'forum_member', ) + tuple(get_machina_apps()) and I've added a forumapps.pth file at the Project level containing: # machina package configuration apps Now, when I run python manage.py makemigrations forum_member, it shows the following error: E:\btcat>python manage.py makemigrations forum_member Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line utility.execute() File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 327, in execute django.setup() File "C:\Python27\lib\site-packages\django\__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Python27\lib\site-packages\django\apps\registry.py", line 85, in popu late app_config = AppConfig.create(entry) File "C:\Python27\lib\site-packages\django\apps\config.py", line 90, in create module = import_module(entry) File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) ImportError: No module named forum_member I'm scouring through the internet to …