Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Building Django-Projects on GCPs Cloud-Build
Recently, we started working to convert an established Django project from a docker stack to Google App Engine. On the way, Google Cloud Build turned out to come handy. Cloudbuild takes care of a few items in preparation of rolling out, in particular the front end part of the application. Now when it comes to python and Django specific tasks, the obvious choice is to resort to cloudbuild as well. Therefore we tried to follow the pattern Google explains with their official NPM cloud-builder (here) The issue we are facing is the following. When building with the official python image, the buildsteps are set up as followed: steps: [...] 8 - name: 'python:3.7' 9 entrypoint: python3 10 args: ['-m', 'pip', 'install', '-r', 'requirements.txt'] 11 - name: 'python:3.7' 12 entrypoint: python3 13 args: ['./manage.py', 'collectstatic', '--noinput'] This works just fine for the first step, to install all requirements. GAE does that when deploying the application as well, but here it's necessary to collectstatic from the repository and installed django apps, before uploading them. While the first step succeeds with the above, the 2nd step fails with the following error: File "./manage.py", line 14, in <module> ) from exc ImportError: Couldn't import … -
Annotate returning individual elements rather than grouping
Here are my models: class Submission(models.Model): user = models.ForeignKey(to=DefaultUser, on_delete=models.CASCADE) total_score = models.DecimalField() Now I want to get the count of submissions for each user And here is the query that I am trying Submission.objects.values('user').annotate(Count('id')) And the output is: {'user': 1, 'id__count': 1} {'user': 1, 'id__count': 1} {'user': 1, 'id__count': 1} {'user': 1, 'id__count': 1} {'user': 2, 'id__count': 1} {'user': 2, 'id__count': 1} {'user': 3, 'id__count': 1} Whereas the output that I require is: {'user': 1, 'id__count': 4} {'user': 2, 'id__count': 2} {'user': 3, 'id__count': 1} What am I doing wrong? -
Data.append and bulk_create
It is necessary to write the broken data into the sqlite tables, but append takes 1 argument, how to solve the problem? def handle_parameters_upload(request, file): wb = openpyxl.load_workbook(file, read_only=True) first_sheet = wb.get_sheet_names()[0] ws = wb.get_sheet_by_name(first_sheet) data = [] for row in ws.iter_rows(row_offset=1): recipe = Recipe.objects.create(par_recipe=row[1].value) line = Line.objects.create(par_machine=row[2].value) order = Order.objects.create(par_fa=row[3].value) parameter = Parameter.objects.create( par_rollennr=row[5].value, par_definition_id=row[6].value, par_name=row[7].value ) measurements = Measurements.objects.create( par_value=row[8].value, id_line=line, id_recipe=recipe, id_order=order, id_parameter=parameter ) data.append(parameter, order, line, measurements, recipe) ???.objects.bulk_create(data) return True And how to use the following expression ???.objects.bulk_create(data), after append -
Create autocomplete based on a defined field in the forms.py file. Django -Python.
It tries to create the simplest autocomplete field based on a defined field (ChoiceField) in the forms.py file. I was looking at the information forum, but most of all the answers refer to the autocomplete from the models.py file. An example of a field that is trying to create here. How can I do it in the easiest way? Any help will be appreciated. forms.py class BasicForm(forms.Form): trade = forms.ChoiceField(choices=TYPE_WORK_CHOICES) app_choices.py LOCATION_CHOICES = ( (1, 'trade_1'), (2, 'trade_2'), (3, 'trade_3'), ) views.py def home(request): form = BasicForm(request.POST) if form.is_valid(): cd = form.cleaned_data trade = cd['trade'] query_string = urlencode({'trade': trade}) next_url = '{}?{}'.format(reverse('app:search'), query_string) return HttpResponseRedirect(next_url) return render(request, 'home.html', {'form': form}) -
Django: How to save model instances related by foreign key?
Using custom Django's manage.py commands, I want to fill the database with data, extracted from .tsv file. The structure of db models is shown below. The question is how to tell Django to create and save all the objects related to the ClassificationJob from a data: 'Hey, Django, here is a job with identifier=12231 and link=sample.com, and here is data from file for you' -> 'Now, please, save ClassificationJobTask tasks from data[tasks_index], ClassificationJobResult results from data[results_index],ClassificationJobImage from data['images_index] and provide the relation to my ClassificationJob' import uuid from django.db import models from django.core.validators import MinValueValidator class ClassificationJob(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) identifier = models.CharField(default=None, unique=True, max_length=10) link = models.URLField(default=None) class Meta: db_table = 'classification_jobs' class ClassificationJobTask(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) classification_job = models.ForeignKey(to=ClassificationJob, on_delete=models.CASCADE) assignment_id = models.CharField(unique=True, max_length=36) worker_id = models.CharField(unique=True, max_length=32) points = models.PositiveIntegerField(default=0) class Meta: db_table = 'classification_jobs_tasks' class ClassificationJobResult(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) classification_job_task = models.ManyToManyField(to=ClassificationJobTask) classification_job = models.ForeignKey(to=ClassificationJob, on_delete=models.CASCADE) image_name = models.CharField(max_length=50) image_url = models.URLField() init_result = models.IntegerField(default=-1, validators=[MinValueValidator(-1)]) class Meta: db_table = 'classification_jobs_results' class ClassificationJobImage(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) classification_job = models.ForeignKey(to=ClassificationJob, on_delete=models.CASCADE) image_name = models.CharField(max_length=50) image_url = models.URLField(max_length=50) result = models.IntegerField(default=-1, validators=[MinValueValidator(-1)]) class Meta: db_table = 'classification_jobs_images' MANAGE.PY COMMAND from … -
Django Channels Connect to External Websocket
I'm new to Django and Channels and so far I couldn't find any solution to the issue that I face: I need to communicate with an external WebSocket, to process received data and then sent it to some Channels groups or maybe start some Celery tasks based on that output. As I've understood it's not a good practice to put that logic inside Consumer. What is the right way of doing this in Django? Thanks -
Django sockets with redis and Nginx using uwsgi : No module named ws4redis
I am trying to configure my django app on an amazon ec2 instance and my app uses Django channels for websockets. It uses Redis as a channel layer. I was going over this article and it says to launch a separate uwsgi instance using the following code import os import gevent.socket import redis.connection redis.connection.socket = gevent.socket os.environ.update(DJANGO_SETTINGS_MODULE='my_app.settings') from ws4redis.uwsgi_runserver import uWSGIWebsocketServer application = uWSGIWebsocketServer() and then I can launch my uwsgi socket using the following command uwsgi --virtualenv /path/to/virtualenv --http-socket /path/to/web.socket --gevent 1000 --http-websockets --workers=2 --master --module wsgi_websocket however after using that command I get the error *** Operational MODE: preforking+async *** Traceback (most recent call last): File "./main/wsgi_websocket.py", line 6, in <module> from ws4redis.uwsgi_runserver import uWSGIWebsocketServer ImportError: No module named 'ws4redis' Any suggestions on how I can fix this ? -
django mysql connection error inside docker-compose while running
Dockerfile FROM python:3.6 ENV PYTHONUNBUFFERED 1 WORKDIR /usr/src/govtcareer_api COPY ./ /usr/src/govtcareer_api RUN pip install -r requirements.txt CMD ["/bin/bash"] docker-compose.yml version: "3" services: govtcareer_api: container_name: govtcareer build: . command: "bash -c 'python manage.py migrate --no-input && python manage.py runserver 0.0.0.0:8000'" working_dir: /usr/src/govtcareer_api ports: - "8000:8000" volumes: - ./:/usr/src/govtcareer_api links: - mysql #db mysql: image: mysql restart: always ports: - "3306:3306" environment: MYSQL_DATABASE: "freejobalert" MYSQL_USER: "root" MYSQL_PASSWORD: "Thinkonce" MYSQL_ROOT_PASSWORD: "Thinkonce" MYSQL_HOST: "mysql" MYSQL_PORT: "3306" MYSQL_ALLOW_EMPTY_PASSWORD: "yes" django-database: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'freejobalert', 'USER': 'root', 'PASSWORD': 'Thinkonce', 'HOST': 'mysql', 'PORT': '3306', } } errors: govtcareer | File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 379, in check govtcareer | include_deployment_checks=include_deployment_checks, govtcareer | File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 59, in _run_checks govtcareer | issues = run_checks(tags=[Tags.database]) govtcareer | File "/usr/local/lib/python3.6/site-packages/django/core/checks/registry.py", line 71, in run_checks govtcareer | new_errors = check(app_configs=app_configs) govtcareer | File "/usr/local/lib/python3.6/site-packages/django/core/checks/database.py", line 10, in check_database_backends govtcareer | issues.extend(conn.validation.check(**kwargs)) govtcareer | File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 9, in check govtcareer | issues.extend(self._check_sql_mode(**kwargs)) govtcareer | File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode govtcareer | with self.connection.cursor() as cursor: govtcareer | File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 255, in cursor govtcareer | return self._cursor() govtcareer | File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 232, in _cursor govtcareer | self.ensure_connection() govtcareer | File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection govtcareer … -
Django 2.1: How to import models in a custom .py file?
I'm currently working on a Django project that has the following structure django_project/ django_app/ views.py models.py urls.py src/ myCustomFile.py In this context, I would like to import the models in myCustomFile.py. Usually, to import models in other files I include the following line of code from django_app.models import * but apparently, I do not seem to work. I think that the problem could be due to the fact that myCustomFile.py is in a subfolder. For this reason, I also tried to move myCustomFile.py at the same level of models.py but also, in this case, I get the error ModuleNotFoundError: No module named 'django_app' Do you have any suggestion to solve this problem? Thank you -
Creating records by model
Suppose I have such models: class Recipe (models.Model): par_recipe = models.CharField(max_length=200) class Line (models.Model): par_machine = models.CharField(max_length=200) class Measurements (models.Model): par_value = models.IntegerField(default=0) id_line = models.ForeignKey(Line) id_recipe = models.ForeignKey(Recipe) Do I understand correctly that in this way I have a 1: 1 relationship, and adding entries ids will be automatically created id_line,id_recipe. I will add for example: for row in ws.iter_rows(row_offset=1): recipe =Recipe() line = line() measurements = Measurements() recipe.par_recipe = row[1].value line.par_machine = row[2].value measurements.par_value = row[8].value Do I understand correctly? If not, tell me pls -
Updating django models with multiprocessing pool locks up database
I use Jupyter Notebook to play with the data that I store in django/postgres. I initialize my project this way: sys.path.append('/srv/gr/prg') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'prg.settings') if 'setup' in dir(django): django.setup() There are many individual processes that update the data and I wanted to multithread it to speed up the process. Everything works well when I do updates in a single thread or use sqlite. def extract_org_description(id): o = models.Organization.objects.get(pk=id) logging.info("Looking for description for %s" % o.symbol) try: content = open('/srv/data/%s.html' % o.symbol) except FileNotFoundError: logging.error("HTML file not found for %s" % o.symbol) return doc = BeautifulSoup(content, 'html.parser') desc = doc.select("#cr_description_mod > div.cr_expandBox > div.cr_description_full.cr_expand") if not desc or not desc[0]: logging.info("Cannot not find description for %s" % o.symbol) return o.description = desc[0].text o.save(update_fields=['description']) logging.info("Description for %s found" % o.symbol) return("done %s" % id) And this will not work: p = Pool(2) result = p.map(extract_org_description, orgs) print(result) Most of the time, it will hang until I've interrupted it, without any particular error, sometimes postgres will have "There is already a transaction in progress", sometimes I see "No Results to fetch" error. Playing with the pool size I could make it work maybe once or twice but it's hard to diagnose what exactly the … -
Django: Get currently logged in user, not user from request
I have an external app - on another server and outside of Django project - calling list API view in my Django app and I need to limit the output of the API only to data owned by currently logged in user. So I cannot user request.user, because the request is coming from outside and the user will always be AnonymousUser. Instead, I would need to get the user that is currently logged in my Django app. How do I do that? -
Django model saving on User login
I have a model like this: class Project (models.Model): ''' Defines a project ''' user = models.ForeignKey( Profile, on_delete = models.CASCADE ) ... name = models.CharField ( verbose_name = _('Project Title'), max_length = 100 ) dt_created = models.DateTimeField(editable = False) dt_lastmod = models.DateTimeField(blank=True, null=True) objects = ProjectManager() tags = TaggableManager() class Meta: ordering = ["-id"] def __str__(self): return u'%s' % (self.name) def save(self, *args, **kwargs): if not self.id: self.dt_created = timezone.now() self.dt_lastmod = timezone.now() super(Project, self).save(*args, **kwargs) def get_absolute_url(self): return reverse('view-project', kwargs={'slug': self.slug}) When the 'User' linked to the model through the user field logs in, the model saves and the dt_lastmod is reset. Why? How do I stop this behaviour? -
Related Model cannot be resolved problem when I create user model
In my models, I created UserManager and User and I added this in my settings: AUTH_USER_MODEL = "myapp.User" but when I migrate it raises error related model cannot be resolved. I searched the internet but I couldn't find the answer which solves my problem -
How to run a javascript function in Django admin after the form has been loaded?
The question is pretty self-explanatory. I tried to follow the docs, as found here, however, it seems the function runs before the form has been loaded, which is not useful to me. Any way to do this? Thanks. -
An error was reported while closing the websocket connection(...failed: Invalid frame header)
I use django and dwebsocket. There is a warning in my browser console. Also it runs well. There is no problem :). But i wondered. enter image description here enter image description here views.py import threading from django.shortcuts import render_to_response from dwebsocket.decorators import accept_websocket def index(request): return render_to_response('index.html', {}) clients = [] @accept_websocket def echo(request): if request.is_websocket: lock = threading.RLock() try: lock.acquire() clients.append(request.websocket) for message in request.websocket: if not message: break for client in clients: client.send(message) finally: clients.remove(request.websocket) lock.release() -
how to write raw like query in django2?
I was trying to develop a search application where a user can search and I need to avoid ORM query when I try to write this following raw query q = request.POST.get('searchData') if q: titleInfo = Item.objects.raw("""select * from item where title like '%%s%'""", [q]) It gives me this error ValueError at /test unsupported format character ''' (0x27) at index 41 Where my query is working fine in MySQL database -
Trouble Using Django Shell on PythonAnywhere
I am experimenting with Django Shell on PythonAnywhere. I imported a module and run help() on it. The help text is displayed, but I can't find a way to get back to the prompt. It shows (END) at the end of the help text instead of the prompt. Ctrl + Z completely closes the shell, which is not what I want. -
Django App crashes when deployed to Heroku - Worker failed to boot
Sorry for the long post but wanted to provide as much information as possible. Having some serious issues trying to deploy a django app onto heroku.. Been battling for days with this. The build is successful and so is the deployment but for some reason when navigating to the site address there is an application error. wsgi.py import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoProject.settings") application = get_wsgi_application() settings.py import os import dj_database_url BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) SECRET_KEY = os.environ.get('SECRET_KEY') DEBUG = False ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'blog.apps.BlogConfig', 'users.apps.UsersConfig', 'crispy_forms', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.storage.CompressedManifestStaticFilesStorage' ] ROOT_URLCONF = 'djangoProject.urls' enter code here TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ] WSGI_APPLICATION = 'djangoProject.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') STATIC_URL = '/static/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL … -
Django: 'SessionStore' object has no attribute 'session'
I'm trying to built an E-commerce following a tutorial on Udemy. I'm on the chapter on how to build the cart functionality (how to add items, see total cost and quantity). However, I'm having troubles adding products to cart. AttributeError at /cart/add/4/ 'SessionStore' object has no attribute 'session' views.py: from django.shortcuts import render, redirect from shop.models import Product from .models import Cart, CartItem from django.core.exceptions import ObjectDoesNotExist # Create your views here. def _card_id(request): cart = request.session.session.key if not cart: cart = request.session.create() return cart def add_cart(request, product_id): product = Product.objects.get(id = product_id) try: cart = Cart.objects.get(cart_id = _card_id(request)) except Cart.DoesNotExist: cart = Cart.objects.create( cart_id = _card_id(request) ) cart.save() try: cart_item = CartItem.objects.get(product = product, cart = cart) cart_item.quantity += 1 cart_item.save() except CartItem.DoesNotExist: cart_item = CartItem.objects.create( product = product, quantity= 1, cart = cart, ) cart_item.save() return redirect('cart:cart_detail') def cart_detail(request, total = 0, counter = 0, cart_items = None): try: cart = Cart.objects.get(cart_id = _card_id(request)) cart_items = CartItem.objects.filter(cart = cart, active=True) for cart_item in cart_items: total += (cart_item.product.price * cart_item.quantity) counter += cart_item.quantity except ObjectDoesNotExist: pass return render(request, 'cart.html', dict(cart_items = cart_items, total = total, counter = counter)) models.py from django.db import models from shop.models import Product # Create … -
Dynamic adding apps to Django
I'm building a backend with some core-functionality app (which means, of course, a single DB for the app). I'm looking for elegant way to create app for every new customer by "copying" some template (basic) app to be able modify every's customer app with specific customer's requirements. For ex., I have some basic StoreApp in Django. It could have some basic features, models etc. Now, when some new customer wants to sign up, I want dynamically (not manually) create additional copy of the existing StoreApp (of course, under different name and its own DB), make initial migration for it, register it in the settings and so on. Lately, I want to customize this new app according to the customer's requirements. I'm just looking for a way to separate code maintenance for every existing app, but, as I mentioned before, not to create every app manually. Any elegant way to do it? Some existing plugin for Django? Thanks in advance, Efi -
django not a callable issue
Coming across the error below, not really sure what is wrong. There was phone field missing in the modal which I did not notice before I ran the python manage.py migrate. Now when I try to run the server, I get the error below. I did make changes to the modal( added the phone field) and tried running python manage.py migrate. I thought it would re-migrate but no luck. Getting the same error as below. contacts - models.py: from django.db import models from datetime import datetime # Create your models here. class Contact(models.Model): listing = models.CharField(max_length=200) listing_id = models.IntegerField() name = models.CharField(max_length=200) email = models.CharField(max_length=200) phone = models.CharField(max_length=200) message = models.TextField(blank=True) contact_date = models.DateField(default = datetime.now, blank = True) user_id = models.IntegerField(blank=True) def __str__(self): return self.name contacts - admin.py - from django.contrib import admin # Register your models here. from .models import Contact class ContactAdmin(admin.ModelAdmin): list_display =('id', 'name', 'listing', 'email' 'contact_date') list_diplay_links=('id','name') search_fields = ('name', 'email', 'listing') list_per_page=25 admin.site.register(Contact, ContactAdmin) Error logs: (venv) User-MBP:btre_project user$ python manage.py runserver Performing system checks... Unhandled exception in thread started by <function check_errors.<locals>.wrapperat 0x110c651e0> Traceback (most recent call last): File "/Users/rizwanrenesa/Desktop/btre_project/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "/Users/rizwanrenesa/Desktop/btre_project/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) … -
Django - How to update form values without clicking?
I am trying to figure out how to update a form input value into another division in the same html file, without clicking, I was thinking about running views periodically(in a sense of polling), but I just need to update the values, when they change in the input field. I tryed to simplify the code below as much as possible. Is it possible using the current layout, or will I have to drop everything and switch to a jQuery approach? forms.py class Entry(forms.Form): quantity = forms.CharField(label = '', required = True, widget forms.TextInput( attrs={'placeholder': 'Quantity','class':"form-control mr-sm-2"})) views.py def index(request): form = forms.Entry() if request.method == 'POST': form = forms.Entry(request.POST) if form.is_valid(): print("Validation Successful") quantity = form.cleaned_data['quantity'] return render(request, 'index.html', {'form':form, 'Quantity':quantity * 2}) index.html <form method = "POST" class="form-inline" id = "myForm"> {{ form }} {% csrf_token %} <button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="but" >+</button> </form> <div> {{Quantity}} </div> Thanks Jaime -
Django 2.1 Test Issue
first of all thank you for your time and sorry about my english. Im learning Django, I had several years developing with python and decided to start to check this Framework. And I'm getting an weird responses. Im writting a TestCase, wich works perfectly outside Test. That is the code: class BoardTopicsTests(TestCase): # Hago las acciones necesarias para empezar el test def setUp(self): self.board = Board(name="Django", description="Django board.") # self.board.save() # Compruebo el status_code 200 def test_board_topics_view_status_code(self): # self.board.save() url = reverse("board_topics", kwargs={"pk":1}) response = self.client.get(url) self.assertEqual(response.status_code, 200) # Compruebo el status_code 404 def test_board_topics_view_not_found_status_code(self): url = reverse("board_topics", kwargs={"pk" : 99}) response = self.client.get(url) self.assertEqual(response.status_code, 404) # Compruebo que resuelve bien el board def test_board_topics_url_resolves_board_topics_views(self): view = resolve("/boards/1/") self.assertEqual( view.func.__name__, BoardTopics.as_view().__name__ ) If I save the board in setUp the method test_board_topics_view_status_code returns 404, if I save the board inside the method it returns 200 and pass the test. I think I'm missing something because I think it have to work saving from setUp method! Please, can somebody help with that? It's just for learning purposes because I want to know whats happening there. If I do print(self.board.id) inside test_board_topics_view_status_code it returns 1 as it suposed to be. Thank you … -
How to integrate cyber-ark with a Django application?
I have a django web application that connects to the production database( Oracle 12g ). I have to use Cyberark for storing the user id and password for connecting to database. Till now my database connection password and user id were mentioned in the DATABASE setting of the settings.py file as clear text. In some other applications( not coded in django ) we have modified the connection string in the tomcat server to connect to the cyberark driver and get the user name password to connect to the database. But I am new to django and dont know where to look for, for the connection string to connect to the database. Which django file picks up the database information from the settings.py file and actually connects to the database? How to integrate cyberark with Django? We are using Gunicorn as wsgi server and nginx as reverse proxy server. We have found a python module named PyArk but haven't found anybody who has used it. If anybody has used it or can answer the above questions, it would be very beneficial for me.