Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
strftime() cannot use in reverse()
I am just following "Django by example",while my version has been Django 2.0, and I am confusing how to do towards the code below: get_absolute_url. And before that, I have import reverse() correctly. -
AWS not using SDK or CLI Angular Django authorization mechanism failure wants 256
I am using angular and django to send files to s3 bucket via browser based post. I first go to django create a new row in my database to house the file location path. Then set up all the authorization and signature calculation requirements. I then return the paramaters. Create a fileform append all params and the file and send off to AWS. Then I receive the error: the authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256 For the sake of learning and to really see where it is I am screwing up I am including my full implementation in both the backend and frontend. samplemenuupload(event){ let awspolicy = null; let samplemenuobject = null; let submittedpdfs = []; submittedpdfs = event.target.files; // need to set up a check to make sure file is valid if(submittedpdfs.length > 0){ for(let pdf in submittedpdfs){ const payload = { venue: this.venueobject.id }; I grab the file and create a payload object to send to my backend to calculate a signature and create a new relation to the file and the object it is relating to in my database. this.awsservice.samplemenucreateandpolicy(this.venueobject.id,payload) .subscribe( (req:any)=> { awspolicy = req; samplemenuobject = req.venuemenuobject; let content = … -
Which `format` would be negotiated for REST request?
There are three variants of format selection: curl -uadmin:admin "http://localhost:8080/alfresco/service/hellouser.json" curl -uadmin:admin "http://localhost:8080/alfresco/service/hellouser?format=json" curl -uadmin:admin -H "Accept: text/html" "http://localhost:8080/alfresco/service/hellouser" But this is unclear from the DOC what format would be selected for next query: curl -uadmin:admin -H "Accept: text/html" "http://localhost:8080/alfresco/service/hellouser.xml?format=json" I expect json here, but may someone confirm this by supplying links to relevant specifications or documentation? -
Querying GenericRelation field DJango
models.py class Contact(models.Model): attributes = GenericRelation( AttributeValue,related_query_name='contact',content_type_field='target_content_type',object_id_field='target_object_id') class AttributeValue(models.Model): attribute = models.ForeignKey(Attribute, related_name="attribute") # the object instance we are associating this attribute to target_content_type = models.ForeignKey(ContentType, related_name="attribute_value_target_content_type", on_delete=models.CASCADE, blank=True, null=True) target_object_id = models.PositiveIntegerField(blank=True, null=True, db_index=True) target = GenericForeignKey('target_content_type', 'target_object_id') class Attribute(models.Model): name = CHarFIeld() I want to get all the contacts that follow both the conditions below Have an AttributeValue model object in attributes field with attributes__attribute__name = 'crop_name' and attributes__value='groundnut' Have an AttributeValue model object in attributes field with attributes__attribute__name = 'crop_season' and attributes__value='winter' One way to achieve this is mentioned as follows: Contact.objects.all().filter(Q(attributes__attribute__name='crop_name') & Q(attributes__value='groundnut')).filter(Q(attributes__attribute__name='crop_season') & Q(attributes__value='winter')) The above mentioned query works fine. But I want to construct a single such query that can be given into .filter() i.e. something like Contact.objects.filter(query) I tried doing something like Contact.objects.filter(Q(Q(attributes__attribute__name='crop_name') & Q(attributes__value='groundnut'))& Q(Q(attributes__attribute__name='crop_season') & Q(attributes__value='winter'))) Expecting that query would respect the braces, but it doesn't like that i guess P.S. I am using django(1.11.4) + postgres(9.5.7) combination -
Django One to Many relationship urls
I use to django for my web site. But ı have a question about blog/urls.py(my app name is blog ) I use to with one to many releationship in blog/models.py. Category (1 => *) Subject (1 => *) Article. class Category(models.Model): name = models.CharField(max_length=200) statement = models.TextField() slug=models.SlugField() page_name = models.ForeignKey('Page', on_delete=models.CASCADE) def __str__(self): return self.name class Subject(models.Model): name = models.CharField(max_length=200) statement = models.TextField() slug=models.SlugField() category_name = models.ForeignKey('Category', on_delete=models.CASCADE) def __str__(self): return self.name class Article(models.Model): author = models.ForeignKey('auth.User', on_delete=models.CASCADE) title = models.CharField(max_length=200) slug=models.SlugField() text = models.TextField() created_date = models.DateTimeField( default=timezone.now) published_date = models.DateTimeField( blank=True, null=True) subject_name = models.ForeignKey('Subject', on_delete=models.CASCADE) def publish(self): self.published_date = timezone.now() self.save() def __str__(self): return self.title def get_absolute_url(self): return reverse('blog:detail', kwargs={'id' : self.id}) blog/views.py def detail(request,article_slug): article = get_object_or_404(Article, slug=article_slug) article_list=Article.objects .all() subject_list = Subject.objects.all() context={ 'article': article, 'article_list':article_list, 'subject_list': subject_list } return render(request, 'blog/detail.html', context) blog/urls.py url(r'^(?P<category_slug>[\w-]+)/(?P<subject_slug>[\w-]+)/(?P<article_slug>[\w-]+)/$', views.detail, name='detail'), I want to see the url when I click on the links of my article http://127.0.0.1:8000/myworkandresearch/category_slug/subject_slug/article_slug blog / urls.py 'How can I edit? -
Unity3D / Django rest api
I am developing a graphic interface with unity and want it to interact with a Django REST API. I don't seem to have any documentation on this issue. Is this possible ? Do you have any documentation that could help ? -
Django manually fail transaction after done with for loop
I'm trying to run over a for loop that validates objects and saves them, and I want to fail it all if at least one have failed, but only after going over all the objects. I've tried different approaches, but on all of them - even if there was an exception, at least one object was saved to DB. In the latest version, see below, I'm trying to set transaction.set_rollback(True) if at least on exception was raised. try: is_failed = False with transaction.atomic(): for identifier, spec in spec_dict.items(): try: spec_data = {'title':my_title, 'identifier': identifier, 'updated_by': user_id, 'created_by': user_id } serializer = SpecSerializer(data=spec_data) serializer.is_valid(raise_exception=True) serializer.save() except DataError as DE: print("** in DataError") is_failed = True pass except ValidationError as VE: print("** in ValidationError") print(str(VE)) is_failed = True pass except Exception as Exc: print("** inside Exception: " + str(Exc)) is_failed = True pass if is_failed: transaction.set_rollback(True) except IntegrityError: print("** inside integrity error") pass Seems like the 'set_rollback' doesn't affect the transaction. Worth to mention that all our http requests are wrapped in transaction. -
Cannot create file inside Python on Amazon ElasticBeanstalk
I'm trying to create a file inside a Django project on Amazon ElasticBeanstalk WebServer Environment. However it gives me a Permission Denied error. Here is the error. Traceback (most recent call last): File "/opt/python/current/app/foo/boo.py", line 25, in create_file input_file = open(input_filename, "w") IOError: [Errno 13] Permission denied: 'testing.txt' Thanks in advance! -
Duplicate key value violates unique constraint on database initializzation
I have a model for a blog where I want to set the finished field equals True if the other fields are not empty. I populate the database (Postgres) using a script but somethings is not working on initializzation (database is empty, but after migration, so the tables exist). my models.py: class Post(models.Model): ... def save(self, *args, **kwargs): super(Post, self).save(*args, **kwargs) if self.title_it!='' and self.title_en!='' and self.text_it!='' and self.text_en!='' and self.tags!='': self.finished=True super(Post, self).save(*args, **kwargs) My script init.py: def add_post(author, title_it, title_en, text_it, text_en, created_date, published_date, tags, views): p = Post.objects.get_or_create(author=author, title_it=title_it, title_en=title_en, text_it=text_it, text_en=text_en, created_date=created_date, published_date=published_date, views=views)[0] for t in tags: p.tags.add(t) p.save() return p and the error when I run the script: django.db.utils.IntegrityError: ERROR: duplicate key value violates unique constraint "blog_post_pkey" DETAIL: Key (id)=(1) already exists. Here the full traceback: Traceback (most recent call last): File "D:\progetti\Envs\possedimenti\lib\site-packages\django\db\models\query.p y", line 487, in get_or_create return self.get(**lookup), False File "D:\progetti\Envs\possedimenti\lib\site-packages\django\db\models\query.p y", line 403, in get self.model._meta.object_name blog.models.DoesNotExist: Post matching query does not exist. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\progetti\Envs\possedimenti\lib\site-packages\django\db\backends\utils .py", line 85, in _execute return self.cursor.execute(sql, params) psycopg2.IntegrityError: ERRORE: un valore chiave duplicato viola il vincolo un ivoco "blog_post_pkey" DETAIL: La … -
IntegrityError exception in DeleteView CBV
I'm back with more Django Class Based View questions. I have an "extended" user model in the form of a "profile" model. The profile model is using CBVs to implement CRUD functionality but the DeleteView always generates FOREIGN KEY constraint failed IntegrityError exception. I know what that should mean but I am not sure why I am getting that exception. I have the built-in Django user model plus an "account adaptor" and my custom Profile model. The account adaptor just sets the signup email address as the username: class AccountAdapter(DefaultAccountAdapter): def save_user(self, request, user, form, commit=True): Log.add("") data = form.cleaned_data user.username = data['email'] # username not in use user.email = data['email'] if 'password1' in data: user.set_password(data['password1']) else: user.set_unusable_password() self.populate_username(request, user) if commit: user.save() return user The Profile model has a OneToOneField to attach a profile instance to a user. class Profile(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, blank=False, null=False, ) The DeleteView CBV is: @method_decorator(verified_email_required, name='dispatch') class Delete(DeleteView): pk_url_kwarg = "account_number" model = Profile form_class = ProfileForm success_url = "/accounts/logout.html" def get(self, request, *args, **kwargs): try: profile = self.model.objects.get(account_number=self.kwargs[self.pk_url_kwarg]) user = User.objects.get(pk=profile.user.pk) user.delete() messages.success(request, "The user is deleted") my_render = render(request, self.success_url) except User.DoesNotExist: messages.error(request, "User does not exist") my_render = … -
Django - change foreign key's default field on django forms
The default field for a foreign key on django forms is . I want to change that to be an field so I can create an autocomplete search with jQuery because it won't be nice with a large amount of options. Here's is what I have. enter image description here When I submit I get the following error. enter image description here Now my problem is, how do I pass the cliendId from the form. Here's my jQuery. enter image description here -
Django 2.0.1: Looping to create radio buttons breaks "required" setting
I have struggled with this problem for a while so I appreciate any help, however vague. Django 2.0.1: The "required" setting that Django uses for validating whether a field is valid works fine if I input: {{ client_primary_sector }} in to the applicable html file with the "required" setting chosen via the data model (blank=False) or via forms.py (attrs={"required": "required"}). However, the "required" setting fails when I use for loops to produce radio buttons. See below for a working and broken example. models.py: class SurveyInstance(models.Model): client_primary_sector = models.CharField(choices=PRIMARY_SECTOR, null=True, default='no_selection', blank=False, max_length=100) forms.py class ClientProfileForm(ModelForm): class Meta: model = SurveyInstance fields = ('client_primary_sector',) widgets = {'client_primary_sector': forms.RadioSelect(choices=PRIMARY_SECTOR, attrs={"required": "required"}), } views.py def client_profile_edit(request, pk): # get the record details from the database using the primary key survey_inst = get_object_or_404(SurveyInstance, pk=pk) # if details submitted by user if request.method == "POST": # get information from the posted form form = ClientProfileForm(request.POST, instance=survey_inst) if form.is_valid(): survey_inst = form.save() # redirect to Next view: return redirect('questionnaire:business-process-management', pk=survey_inst.pk) else: # Retrieve existing data form = ClientProfileForm(instance=survey_inst) return render(request, 'questionnaire/client_profile.html', {'form': form}) client_profile.html <!-- this works: --> <!-- <div class="radio_3_cols"> {{ form.client_primary_sector }} </div> --> <!-- this doesn't: --> {% for choice in form.client_primary_sector %} … -
my url parameter is not reaching my view in django
The url parameter is not reaching my view. My urls is defined as follow where the category_code is the parameter: # posting image for a post url(r'^post/photo/(?P<category_code>[0-9]+)/$', views.post_photo, name='post_photo_url'), and my view as follow where I expect my url parameter category_code: @api_view(['POST']) def post_photo(request, category_code): """ Post all the PHOTO URL for that POST """ if request.method == 'POST': data = JSONParser().parse(request) serializer = PhotoURLSerializer(data=data) if serializer.is_valid(): photoUrl = serializer.save() set_thumbnail(photoUrl.post_id, category_code, photoUrl.url) return JsonResponse(serializer.data, status=201) return JsonResponse(serializer.errors, status=400) But when the view is executing, the function set_thumbnail is getting null from category code, even though from the server log I can see that the parameter has been passed, it's the first line and the parameter value is 2 The URL is receiving data from an android clients using rest api. /* PHOTO FOR POSTS */ @POST("/post/photo/{category_code}/") Call<PhotoURL> createPhotoURL(@Body PhotoURL photoURL, @Path("category_code") int categoryCode); -
implementing local payment gateways in django-oscar
I have a django-oscar application and everything works fine and I have been able to implement the paypal payment option. I am now at a point where I would want to use a local payment gateway suppose paypal is not accepted in my country and there are other local payment options. How do I incorporate this into the ecommerce application and if possible can I match it with the option of pay on delivery. Every contribution is greatly appreciated -
Display grouped records in django template
I am building a races app, where in a template I want to display records from the db, grouped by the year a race took place and by the type of the race. More specifically I want to loop through the Running model (runnings), display the runnings a runner has run and calculate some stats from those runnings (e.g total distance etc), filtered and grouped by race year (race_starts field in Race model) and by the type of the race (type field in Race model). The filtering will be executed dynamically by selecting the year and the type of the race from two bootstrap dropdown menus. Models: class Runner(models.Model): user_id = models.OneToOneField(User, primary_key=True, db_column="user") gender = models.CharField(max_length=1, choices=GENDER_CHOICES) date_of_birth = models.DateField('date_of_birth') address = models.CharField(max_length=50, null=True, blank=True) postalcode = models.CharField(max_length=5, null=True, blank=True) city = models.CharField(max_length=20, null=True, blank=True) class Race(models.Model): race_name_id = models.ForeignKey(RaceName, db_column='race_name') type = models.CharField(max_length=15, choices=TYPES_CHOICES) distance = models.DecimalField(max_digits=7, decimal_places=3) race_starts = models.DateTimeField('race_starts') race_ends = models.DateTimeField('race_ends') runners = models.ManyToManyField(Runner, through='Running') class Running(models.Model): runner_id = models.ForeignKey(Runner, db_column="runner") race_id = models.ForeignKey(Race, db_column="race") approved = models.NullBooleanField(blank=True, default=None) participated = models.NullBooleanField(blank=True, default=None) duration = models.DurationField(null=True, blank=True, default=None) -
Django Validators : check if two fields values have the same id in the database
I'm new to Django, and i have a form that has two fields : Client name & bill number . i've created a validator that tests if the bill number already exists in the database table (called bills). But now i need to transform this validator to another that tests in addition of the previous test, if the Client name exists in the same table line (more smiply : if client name and the bille number have the same pk). The validator : def validate_url(value): try: entry=facture_ventes.objects.get(numfac=value) except ObjectDoesNotExist: entry = None if entry is not None: factexist=facture_ventes.objects.all().filter(id=entry.id).count() if factexist is not None: raise ValidationError("Numéro de Facture déja saisi ! ") the form : class SubmitUrlForm(forms.Form): numfacture=forms.CharField(label='Submit Form', validators=[validate_url]) here is the data base table : https://i.stack.imgur.com/3xmpd.png any help please, cause i know that validators cant return a value so i'm stuck here. Thank You -
Detect from my javascript when my django view is completed
Here's my view: views.py def upload_image(request): if request.is_ajax(): ... return HttpResponse() base.js // how can I detect here that upload_image() has completed? -
401 Unatuhorized("detail":"Authentication credentials were not provided.")
i am using djoser's authentication at backend. when i make a get request at "/account/me/" through post man with content-type and Authorization header i am getting a correct response. But when i try to do same request from my angular client i get 401 Unatuhorized("detail":"Authentication credentials were not provided.") error. here is my angular service import { Injectable } from '@angular/core'; import {homeUrls} from "../../../utils/urls"; import {Http, RequestOptions, Headers Response} from '@angular/http'; import {HttpHeaders,} from "@angular/common/http"; @Injectable() export class AdsService { private headers = new Headers(); private token: string; constructor(private http: Http) { this.token = localStorage.getItem('token'); console.log("token is " , this.token); //this.headers = new Headers({'Content-Type': 'application/json' , 'Authorization': 'Token ' + this.token }); this.headers.append('Authorization', 'Token ' + this.token); this.headers.append('Content-Type', 'application/json'); console.log(this.headers); this.getMe(); } getMe(): Promise<any> { let options = new RequestOptions({ headers: this.headers }); return this.http.get(homeUrls.User, options) .toPromise() .then(res=> { console.log("user is"); console.log(res.json()); }); } and here is the screenshot of headers window of my network tab. any solutions? -
Set dynamic keys/secret for python-social-auth, before every request used for social auth
I am using inside django: social-auth-app-django and python-social-auth[django]. In settings.py I have declared the following variables: SOCIAL_AUTH_FACEBOOK_KEY = '' SOCIAL_AUTH_FACEBOOK_SECRET = '' SOCIAL_AUTH_FACEBOOK_SCOPE = ['email'] SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {'fields': 'name, email'} Everything works ok. But I want to set the SOCIAL_AUTH_FACEBOOK_KEY and the SOCIAL_AUTH_FACEBOOK_SECRET dynamic before every request for social auth, in an middleware or decorator. Why I want this is, because my django app is serving data for multiple sites, and every site has is own keys, and his own domain. I can't find a way to overwrite the variables in settings, or to send the keys to social_auth. -
Using a searchbox with dropdown in all pages how can I call different views
I have a search box, that will be available above all pages. The search box will have also a select box, where you can select in which categories/types you need to search(all or specific). Similar to Amazon/Ebay search box. Depending on what the user selected in the drop-down, on submit the form should call a different ListView and pass also the query parameter. First question how do I pass a different action to the form, in the template depending on what the user selected in the dropdown, and also pass the search parameter"q" to the view. The page with the search box form, it is possible to have on it other forms(like a contact form) with her own submit. How do I manage both of the forms in the View (on get). What I need is what is the best approach, and some code so I can start implement it ? -
Django field duplicate key when creating account
I have a teacher account that I use in my application. Problem now, is that I modified something and I can't figure out the mistake, because when I try to create an account I get this error: IntegrityError at /admin/login/ (1062, "Duplicate entry '' for key 'email'") HEre is the traceback: http://dpaste.com/12R14H1 It seems that the error is coming from this: from courses.models import Notification def notifications(request): if request.user.is_authenticated and request.user.student: student_notifications = Notification.objects.filter(course__student__student_ID=request.user.student.student_ID) return { 'notifications': student_notifications } return {} -
How do I fix traceback error?
root@frenchfries:~/SSHBruteforce# python sshbruteforce.py -I targets.txt -p 22 -U usernames.txt -P passwords.txt -t 15 -T 30 [*] Simple SSH Brute Forcer: By Wildicv [*] Loaded 10 Targets [*] Loaded 11 Usernames [*] Loaded 17 Passwords [*] Brute Force Starting Traceback (most recent call last): File "sshbruteforce.py", line 182, in <module> sshBruteForce.startUp() File "sshbruteforce.py", line 71, in startUp self.multipleTargets(options) File "sshbruteforce.py", line 100, in multipleTargets self.showStartInfo() File "sshbruteforce.py", line 114, in showStartInfo Util.appendLineToFile("%s " % self.info, self.outputFileName) File "/root/SSHBruteforce/Util.py", line 47, in appendLineToFile fileHandler = open(filename,"a") TypeError: coercing to Unicode: need string or buffer, NoneType found root@frenchfries:~/SSHBruteforce# python sshbruteforce.py -i 54.37.224.80 -p 22 -U usernames.txt -P passwords.txt ['admin', 'root', 'toor', 'Root', 'Admin', 'ubnt', '666666', 'password', 'changeme', 'cisco', 'root'] [*] Simple SSH Brute Forcer: By Wildicv [*] Loaded 0 Targets [*] Loaded 11 Usernames [*] Loaded 17 Passwords [*] Brute Force Starting Traceback (most recent call last): File "sshbruteforce.py", line 182, in <module> sshBruteForce.startUp() File "sshbruteforce.py", line 68, in startUp self.singleTarget(options) File "sshbruteforce.py", line 89, in singleTarget self.showStartInfo() File "sshbruteforce.py", line 114, in showStartInfo Util.appendLineToFile("%s " % self.info, self.outputFileName) File "/root/SSHBruteforce/Util.py", line 47, in appendLineToFile fileHandler = open(filename,"a") TypeError: coercing to Unicode: need string or buffer, NoneType found root@frenchfries:~/SSHBruteforce# -
Celery tasks are freezing
I am using django celery with RabbitMQ to schedule my background tasks. I am using celery Group to launch mulitple exe's in parallel and wait for their result. @shared_task(name='taskBuilder') def taskBuilder(requestJson): # only one task will run at a time in memory lock = FileLock("lock.task") running = True while running: if lock.acquire(): logger.info("Task lock acquired for %s", taskId) try: # chain the tasks based on the type of result res = None task = Task.objects.get(task_id=taskId) fileList = getInputFileList(requestJson.get( 'copy_destination'), requestJson['contents']) res = group(summaryWrapper.s(fileName, requestJson) for fileName in fileList).delay() res.join() logger.info( "Task with id : '%s' completed successfully", taskId) lock.release() running = False except Exception as e: logger.exception("Task with id : '%s' failed", taskId) lock.release() running = False else: # let us wait to acquire the task logger.info("Waiting to acquire lock for %s", taskId) time.sleep(30) The above task calls another task in parallel: @shared_task(name='summaryWrapper') def summaryWrapper(fileName, requestJson): """ Wrapper task for calling run summary """ logger.info(fileName) try: logger.info("Starting processing %s", filePath) os.makedirs(folderPath) arguments = [SUMMARIZER_EXE, filePath, folderPath] newProcess = subprocess.Popen( arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdOut = "" stdErr = "" while newProcess.poll() == None: logger.info("Processing of %s in progress", filePath) logger.info("Sleeping for 1 second") stdOut = stdOut + newProcess.stdout.read().decode("utf-8") stdErr = stdErr … -
Django admin panel django.db.utils.IntegrityError: FOREIGN KEY constraint failed
I am using django version 2.0 getting integrity error while trying to add model element from admin panel. Although i can add element from shell. models.py class Book(models.Model): name = models.CharField(max_length=30) def __str__(self): return self.name admin.py admin.site.register(Book) i am using sqlite database Got following error when add from admin panel Internal Server Error: /admin/accounts/book/add/ Traceback (most recent call last): File "/myproject/env/lib/python3.4/site-packages/django/db/backends/base/base.py", line 239, in _commit return self.connection.commit() sqlite3.IntegrityError: FOREIGN KEY constraint failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/myproject/env/lib/python3.4/site-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/myproject/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 128, in _get_response response = self.process_exception_by_middleware(e, request) File "/myproject/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 126, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/myproject/env/lib/python3.4/site-packages/django/contrib/admin/options.py", line 574, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/myproject/env/lib/python3.4/site-packages/django/utils/decorators.py", line 142, in _wrapped_view response = view_func(request, *args, **kwargs) File "/myproject/env/lib/python3.4/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/myproject/env/lib/python3.4/site-packages/django/contrib/admin/sites.py", line 223, in inner return view(request, *args, **kwargs) File "/myproject/env/lib/python3.4/site-packages/django/contrib/admin/options.py", line 1553, in add_view return self.changeform_view(request, None, form_url, extra_context) File "/myproject/env/lib/python3.4/site-packages/django/utils/decorators.py", line 62, in _wrapper return bound_func(*args, **kwargs) File "/myproject/env/lib/python3.4/site-packages/django/utils/decorators.py", line 142, in _wrapped_view response = view_func(request, *args, **kwargs) File "/myproject/env/lib/python3.4/site-packages/django/utils/decorators.py", line 58, in bound_func return func.__get__(self, type(self))(*args2, **kwargs2) … -
Reusing database generated by django in a new deployment
I have deployed a django project on a testing server with a postgresql database. Now I want to migrate the whole project on a production server. I have dumped my database. I have installed exactly the same environment on the production server; I have executed the command "python manage.py migrate" and then I have populated the database with the dump sql file. When I query the database through the postgresql client, everything is fine. But when I query it using the django shell, I got only empty query sets ! Did I miss something ? I have failed to find any documentation on this topic. Thanks in advance for your help. Best regards.