Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How do you link the primary key of two apps together
Well basically i have two apps that share the same Name field and I wanted to know how to generate the primary key based on checking if the Name model in one of the app matches that of other and allocates the primary key of the first app to that of the second I tried that with the get_pk fuction as shown below but it didnt work Thanks Model class InfoPedia(models.Model): #User model due to association user =models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE) Name =models.ForeignKey(MainPage,on_delete=models.CASCADE) #Information unique to this app Location =models.CharField(max_length= 50,null=True,blank=True) Information =models.TextField(null=True,blank=True) TrackListing=models.TextField(null=True,blank=True, help_text="Seperate by Coma") Published=models.BooleanField(default=True) Timestamp=models.DateTimeField(auto_now=True) Updated=models.DateTimeField(auto_now=True) def _get_pk(self, meta=None): Tempn=MainPage.objects.get(Name=self.Name) if Tempn.Name==self.Name: self.pk=Tempn.pk return self.pk # # def get_absolute_url(self): # return reverse("InfoPedia:details", kwargs={"pk":self.pk}) # def __str__(self): # return self.Name # You use this to make each item a hyperlink based on the detail view and put it the detailview template def get_absolute_url(self): # return f"/Blog/{self.slug}" return reverse('InfoPedia:DetailView', kwargs={"pk":self.pk}) class Meta: ordering=["-Updated","-Timestamp"] #orranges in order of updated def get_tracklist(self): return self.TrackListing.split(",") def Information_create_pre_save( instance, sender, **kwargs): instance.Information=retriever(instance.Name) # instance.TrackListing=WikiPage.categories -
Upload tempfile in Django
I've created a tempfile and I am trying to upload it into a model with a FileField. I keep getting this error message: AttributeError: '_io.BufferedRandom' object has no attribute '_committed' Here is what my code looks like: my_item = {} my_filename = 'name' temp_file = tempfile.TemporaryFile() json_text = json.dumps(an_item) json_byte = str.encode(json_text) temp_file.write(json_byte) temp_file.name = my_filename file_instance = MyFileModel(file=temp_file) file_instance.save() temp_file.close() -
Unable to connect to django 1.11 web app on Apache server
I am no expert on Django. I am able to run the app on my local machine well. I want to deploy this app on our internal server. Versions I am using: Python: 2.7, Django 1.11, Apache: 2.4 Ports Open: 9991 When I access the port from any machine, it gives me no error. For e.g. xxx.xx.xxx.xxx:9991 shows Apache page. But when I add the URL to the app xxx.xx.xxx.xxx:9991/WebApp1Url it gives error. Below is my configuration of httpd.conf Listen 9991 <VirtualHost *:9991> Alias /static "C:/xxx/DjangoSite/WebApps/WebApp1/static" <Directory "C:/xxx/DjangoSite/WebApps/WebApp1/static"> Require all granted </Directory> <Directory "C:/xxx/DjangoSite/WebApps/WebApps"> <Files wsgi.py> Require all granted </Files> </Directory> </VirtualHost> Below is my wsgi.py: import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "WebApps.settings") application = get_wsgi_application() from WebApp1.wsgi import WebApp1 application = WebApp1(application) settings.py contains: WSGI_APPLICATION = 'WebApps.wsgi.application' I can assure that the paths to static and wsgi.py are correct. I can't figure out what is not right. Can someone please provide pointers as to which step is missing? Any help is appreciated. Pardon any typos above. Thank you in advance. -
How to change hierarchy of HTML form
I have a form for a workout calendar that looks like this: Just by looking at it, you can probably guess how it's supposed to work. Each ROW is a unit, with for example a Lift name, with No of sets, No of reps (one per set) and Weight (one per set). When I submit this form, I'd like the server to receive something like this: { "date": ['Nov. 22, 2017, midnight'], "lifts":[ {"name":"benchpress", "no_of_sets":2, "reps":[3,3], "weight":[70,70]}, {"name":"deadlift", "no_of_sets":3, "reps":[3,4,4], "weight":[80,75,75]}, {}, {} ], "cardio_activities":[ {"name":"running", "duration":25, "distance":2.5} ] } Unfortunately, right now, it's producing this: <QueryDict: {'csrfmiddlewaretoken': ['u8HH7g7bWRVlX5UW3cdaCW19dLeEyq9OH1USdPgmaa5d4yRhyiEHBfpLQkd5jy5R'], 'date': ['Nov. 22, 2017, midnight'], 'lift_string': ['benchpress', 'deadlift', '', ''], 'sets': ['2', '3', '', ''], 'reps': ['3', '3', '3', '4', '4'], 'weight': ['70', '70', '80', '75', '75'], 'cardio_string': ['running'], 'minutes': ['25'], 'distance': ['2'] } > It's not impossible to work with this dictionary, but it is very counter intuitive and non-practical. Is there any way to shape how the QueryDict will be structured? Here's the django template I'm using: <form action="{% url 'workoutcal:add_workout' date.year date.month date.day %}" method="post"> {% csrf_token %} <div class="row"> <div class="col-xs-2"> <p id="date">{{ date.year }}-{{ date.month }}-{{ date.day }}</p> <input type="hidden" name="date" value="{{ date }}"> </div> </div> … -
Django rest manytomany create object instances
I have two models as following (basically a Reader will have many Books in his wishlist): class Reader(models.Model): user = models.OneToOneField(User) ... # A library has many readers which_library = models.ForeignKey('Library', related_name='readers', on_delete=models.CASCADE) class Book(models.Model): book_id = models.AutoField(primary_key=True) title = models.CharField(max_length=30) ... # A library has many books which_library = models.ForeignKey('Library', related_name='books', on_delete=models.CASCADE) # Record the date whenever a new book is added, it will be helpful for showing new arrivals when_added = models.DateTimeField(auto_now_add=True, blank=True, null= True) reader = models.ManyToManyField('Reader', related_name='wishlist') my serializer: class ReaderSerializer(serializers.ModelSerializer): username = serializers.CharField(source='user.username') email = serializers.CharField(source='user.email') password = serializers.CharField(source='user.password') class Meta: model = Reader #fields = '__all__' depth = 1 fields = ('id', 'username', 'email', 'password', 'phone', 'address', 'dob', 'which_library') def update(self, instance, validated_data): instance.user.email = validated_data.get('user.email', instance.user.email) instance.user.password = validated_data.get('user.password', instance.user.password) instance.phone = validated_data.get('phone', instance.phone) instance.address = validated_data.get('address', instance.address) instance.dob = validated_data.get('dob', instance.dob) instance.which_library = validated_data.get('which_library', instance.which_library) instance.save() return instance def create(self, validated_data): user_data = validated_data.pop('user') user = User.objects.create(**user_data) user.set_password(user_data['password']) user.save() reader = Reader.objects.create(user=user, **validated_data) return reader I can create a Reader by making a POST call with following data: { "username": "sample5", "email": "sample5@gmail.com", "password": "5647", "phone": "836365", "address": "sample5 address", "which_library": "1" } I want to implement a logic/view so that a … -
In Django Signals, What is difference between these two codes?
First CODE: @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() Second CODE: @receiver(post_save, sender=User) def create_or_save_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) else: instance.profile.save() Is there any difference in actually what they work? -
implementing PayPal IPN in Django Application
I'm writing an application in Django 2.0 It is a multi membership application. I have to implement PayPal payment method and activate the membership based on payment received. For this, I have created a button in PayPal with generates code as upgrade.html <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="<button-id>"> <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> and views.py is class Pricing(TemplateView): template_name = 'membership/pricing.html' class Upgrade(TemplateView): template_name = 'membership/upgrade.html' class PaymentSuccess(TemplateView): template_name = 'membership/payment-success.html' class PaymentFailed(TemplateView): template_name = 'membership/payment-failed.html' def paypal_ipn(request): # IPN response goes here and urls.py urlpatterns = [ path('pricing/', Pricing.as_view(), name='pricing'), path('upgrade/', Upgrade.as_view(), name='upgrade'), path('payment-success/', PaymentSuccess.as_view(), name='payment-success'), path('payment-failed/', PaymentFailed.as_view(), name='payment-failed'), path('paypal-ipn/', paypal_ipn, name='paypal-ipn'), ] All is working fine as Payment is being made and user is redirected to the payment-success page. But How do I receive the payment confirmation so that I could process the membership and record the transaction data in the database? I have enabled instant payment notification from the settings in paypal sandbox accoun on url https://example.com/paypal-ipn/ I do not want to use django-paypal plugin due to some limitations. -
How to structure an object whos time field depends upon another objects time field
Basically there's an Appointment model, along with an Available_Hours model. The Appointment model is used by the customers. The Available_Hours is used by the employees to set their hours for a given day, so each of these objects is for a given day. The Appointment object time field needs to be dependent on the Available_Hours object. So that when the customer creates an appointment there will be a dropdown select field that displays all of the available hours employees have. Sorry if this is a stupid question, I am new to working with databases. Any help is extremely appreciated! -
Starting rqworker using supervisor causes spawn error
Trying to start rqworker as stated in its README using this command: python manage.py rqworker default For some reason it gives ERROR (spawn error) and status shows FATAL Exited too quickly (process log may have details). Logs has no any information for error (exit status 1; not expected). My supervisor configuration: [program:rqworker] user=ubuntu directory=/var/www/project/ command=/var/www/project/venv/bin/python manage.py rqworker default > /var/log/project/rq.log stopsignal=TERM autorestart=true autostart=true numprocs=1 Running command directly from ubuntu user works as expected. -
Python-Django error when importing data from settings.py
I am trying to import DB settings from settings.py but I am getting an error: Traceback (most recent call last): File "Read_Data.py", line 12, in read_bbg dbHost = settings.DATABASES['default']['HOST'] KeyError: 'default' import psycopg2 import csv from django.conf import settings import sys def read_bbg(file): """ read from csv and insert into db table """ settings.configure(DEBUG=True) dbHost = settings.DATABASES['default']['HOST'] dbUsername = settings.DATABASES['default']['USER'] dbPassword = settings.DATABASES['default']['PASSWORD'] dbName = settings.DATABASES['default']['NAME'] conn_string = """host='{0}' dbname='{1}' user='{2}' password='{3}' sslmode='require' """.format(dbHost,dbName,dbUsername,dbPassword) print(conn_string) conn=None """ ##rest of the code## """ the settings.py is located in ./cf_proj directory and the read_bbg function is in ./coveredfunds/Read_Data.py Could anyone help me with this error? -
Can't generate download links using Django
I'm trying to make a website for downloading youtube videos using django. The procedure i'm following is, user gives the video link from youtube, my view function downloads the video into my server and deliver the directory link of that downloaded video file as download link. I am able to generate the video link but the link doesn't work. My view for the project is: def index(request): X = find() latest_downloads = Download.objects.order_by('dw_date')[:5] output = ','.join([q.download_text for q in latest_downloads]) downloaded_file_name = "None" file_download_link = "None" if request.method == "POST": link = request.POST['link'] generated = "youtube-dl "+ link os.system(generated) downloaded = True if downloaded: downloaded_file_name = X.find_name('*.mkv', '/home/kazirahiv/yao') file_download_link= X.find_link('*.mkv', '/home/kazirahiv/yao') else: downloaded = False template = loader.get_template('grab/index.html') contex = {'latest_downloads': latest_downloads, 'downloaded':downloaded, 'file_download_link':file_download_link} return HttpResponse(template.render(contex, request)) And the template is: <form name="MyForm" method="POST" action="">{% csrf_token %} <fieldset> <legend>Download Youtube Videos:</legend> Paste below:<br> <input type="text" name="link"><br> <input type="submit" value="Submit"> </fieldset> </form> {%if downloaded %} <p> Download Complete </p> <a href="file://{{file_download_link}}" download>Download link</a> {% else %} <p> No task given ! </p> {% endif %} {% if latest_downloads %} <ul> {% for download in latest_downloads %} <li><a href="/grab/{{downlod.id}}/">{{ download.download_link }}</a></li> {% endfor %} </ul> {% else %} <p> No recent downloads … -
Make attribute in admin.py "clickable" to edit?
So I have something like this in admin.py from .models import Venue class VenueAdmin(admin.ModelAdmin): list_display = ["country", "zip", "city", "name", "street"] admin.site.register(Venue, VenueAdmin) When I'm in the django admin I only have the "land"-value clickable to edit the venue. Is it possible to make also or only "name" clickable? Thanks in advance and please keep in mind I'm a newbie in case the answer is too obvious. -
Django Form ---How to delete the initial text from a Form When the Cursor is in the field
I have a django contact form and i want the initial text that is found into the form to dissapear when the cursor is in the field. My form is now: from django import forms class ContactForm(forms.Form): numele_dumneavoastra = forms.CharField(required=True, label="", initial="Numele Dumneavoastra") numarul_de_telefon = forms.CharField(required=True, label="", initial="Numarul de Telefon ") # perioada_cand_va_putem_contacta = forms.CharField(required=True) mesajul_dumneavoastra = forms.CharField(required=True, widget=forms.Textarea, label="", initial="Mesajul Dumneavoastra") emailul_dumneavoastra = forms.EmailField(required=True, label="", initial="Email") The text looks like this image When the user inserts his name e.g. "John Doe" i want the initial text " Numele Dumneavoastra" to dissapear from sight. Thank you! -
JQuery: div class-specific hover not working with bootstrap css
Context: Developing a "google-calendar-like" hardware booking tool at work using DJango. View reservations (their time slot and reserving user). Click empty space to create another reservation (bootstrap modal form) Click on your own reservation to edit (bootstrap modal form) "Calendar" is updated dynamically by querying server (AJAX - GET). Reservation data is updated in a similar fashion (AJAX - POST). example The "calendar" is a custom setup made entirely of divs (I was having trouble with positioning of reservations inside td). <main class="container"> <div class="calendar"> <div class="calendar_col"> <div class="calendar_header"></div> {% for time in time_range %} <div class="calendar_header">{{ time }}:00 - {{ time|add:1 }}:00</div> {% endfor %} </div> {% for weekday in weekdays %} <div style="height: {{ time_range|length|add:1|mul:1.25 }}em" class="calendar_col" id="{{ weekday|lower }}"> <div class="calendar_header">{{ weekday }}</div> {% for time in time_range %} <div id='{{ weekday|lower }}_{{ time }}h' class="calendar_seperator" style="position: absolute; top: {{ forloop.counter|mul:1.25 }}em">&nbsp;</div> {% endfor %} </div> {% endfor %} </div> </main> Some reservations can span multiple days (such as Monday to Thursday in example image). To make it easier to identify such, I want to highlight all the concerned blocks when hovering with mouse. When creating the blocks I give the the "reservation" class and "weekday_reservationpk" for … -
request.POST not found
Got a confusing error. I have this view that, when hit with a post request, should simply print the contents of the request.POST dict to the terminal. However, it says that it doesn't have an attribute 'post'. How is this possible if we're in the post method? class AddWorkoutView(View): def get(self, request, year=None, month=None, day=None): template_name = 'workoutcal/addworkout.html' template = loader.get_template(template_name) date = datetime(year=int(year), month=int(month), day=int(day)) context = { 'date':date, 'current_name':request.user.username, 'title':'Add workout', 'range':range(4), } return HttpResponse(template.render(context, request)) def post(self, request, year=None, month=None, day=None): print(request.POST) # ERROR HERE return HttpResponse("Sent workout. Find in terminal") urls.py: url(r'^add/(?P<year>[0-9]+)/(?P<month>[0-9]+)/(?P<day>[0-9]+)/$', views.AddWorkoutView.as_view(), name = 'add_workout'), The error: Internal Server Error: /workoutcal/add/2017/11/22/ Traceback (most recent call last): File "/Users/sahandzarrinkoub/Documents/Programming/Web/Django/workout/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/Users/sahandzarrinkoub/Documents/Programming/Web/Django/workout/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/sahandzarrinkoub/Documents/Programming/Web/Django/workout/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/sahandzarrinkoub/Documents/Programming/Web/Django/workout/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view return self.dispatch(request, *args, **kwargs) File "/Users/sahandzarrinkoub/Documents/Programming/Web/Django/workout/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch return handler(request, *args, **kwargs) File "/Users/sahandzarrinkoub/Documents/Programming/Web/Django/workout/workout/workoutcal/views.py", line 100, in post print(request.POST) AttributeError: 'WSGIRequest' object has no attribute 'post' EDIT: In case you want to see the form sending the POST request: <form action="{% url 'workoutcal:add_workout' date.year date.month date.day %}" method="post"> {% csrf_token %} … -
Serving static files in production with Apache and FastCGI
I am trying to put my django website to production, but I have a problem with static files. There are plenty of questions about this on google, but none of them helped me. I use Django 1.8.7 with FastCGI and Apache. Everything runs just fine, except of my css. It is not working in templates. I did python manage.py collectstatic and all my static files got copied to /home/username/public_html/mysite/static I also did urlpatterns += staticfiles_urlpatterns() in mysite.urls My settings are: BASE_DIR = '/home/username/public_html/mysite/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' In my template I use {% load static %} <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}"> It gives <link rel="stylesheet" type="text/css" href="/static/style.css"> in template when I check generated html in browser (I think that's ok, isn't it?), but no css works. Do you have a clue, what could help? Do I have to set something for Apache to serve static files? Thanks for your answers. -
Coverage report explanation
I am using pytest-cov to obtain coverage report for a django project (containing folders 'src' for source files and 'tests' contains the tests) using command: pytest --cov-report term --cov=src tests One of the source files, say B, uses a decorator which is defined in file A. The decorator takes in two functions as its parameter which are initialized in file A: def decorator_func(func1=play, func2=stop): ... In file B, 'decorator_func' is used with parameter func2=pause where pause() is defined in file B. In the coverage report for file B, the lines of 'pause' function are shown as missed, but those lines are executed. This affects the percentage coverage. I am trying to understand why this happens? Is it because the decorator function is defined in another file i.e file A? -
Django website not checking the links correctly
I have a django website that contains a table with many servers details. In one of the columns in the table there is "ILO" IP of a server. I wanted the website to check if the "ILO" IP works in http request, and if it does, then it should show the link and if not, shows a text instead. Therefore, in the result, will be servers that has http link to ILO IP and some without. Under my main class in the views I created a function called "checkUrlAvailable" which I try to use in my index.html and check with if condition if I get true or false.. for some reason I get the errorr- Could not parse the remainder: '(server.IP)' from 'checkUrlAvailable(server.IP)' Does anyone know why? index.html- <tr> <th><center> #</center></th> <th width="100%"><center> Server Name </center></th> <th><center> Owner </center></th> <th><center> Project </center></th> <th width="100%"><center> Description </center></th> <th width="100%"><center> IP Address </center></th> <th width="100%"><center> ILO </center></th> <th><center> Rack </center></th> <th><center> Status </center></th> <th><center> Actions {{ response }} </center></th> </tr> </thead> <tbody> {% for server in posts %} <tr> <div class ="server"> <td></td> <td style='white-space: nowrap'><center>{{ server.ServerName }}</center></td> <td width="100%"><center>{{ server.Owner }}</center></td> <td style='white-space: nowrap'><center>{{ server.Project }}</center></td> <td style='white-space: nowrap'><center>{{ server.Description }}</center></td> … -
extending default User model in Django
I've written my first application Django 2.0. Everything is working fine and the application is almost ready when I realized to replace id primary key field from default integer type to UUID to make database entry more secure. When I searched for this how to change id of user table to UUID I got many tutorials extending AbstractBaseUser. Here is I have written own User model. account/models.py class User(AbstractBaseUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) But I'm confused more with examples on different sources. Every example is adding few more fields in extended model like first_name last_name is_staff is_admin active and functions as def get_fullname(self): def get_shortname(self): etc. I think all these fields and functions are there by default in AUTH_USER_MODEL. Does extending AbstractBaseUser overwrites AUTH_USER_MODEL and it is required to add all fields which is there by default? also, I'm using settings.AUTH_USER_MODEL as foreign key in different models. Should It be replaced by account.User model? I'm also using django-allauth plugin to enable login using the social network and use email only for authentication. Do I require to add email field in the extended model with unique=True? -
where to find "if logic" module, python?
I needed to pass a variable in the "if" logic module if it's possible, so I won't need to recreate it? What I want to achieve; Class PythonIfModule(statement): # Code Logic Return Something statement = '(True And True) And "(False And True)' result = PythonIfModule(statement) If you must know what it's for, I need it in the Certainty Factor's conjunction and disjunction of hypothesis; since the system only accepts an Evidence with a certainty factor of 1.0 (True) and 0.0 (False). -
Reverse relationships for accessing user's profile
In my app, there are users with 0 or 1 profile at the same time. Over the time, I project to have many different profiles. Accessing user from profileX is easy : profile_x_object.user But what about the reverse relation? I'd like to find the best generic way to create a relation from user to its profile. For now, I created a property named profile to fill that purpose. It works but it need to be updated foreach new profile I add over time. Any idea to do better? Here is the code I have: class User: # ... @property def profile(self): if hasattr(self, 'profilea'): return self.profilea if hasattr(self, 'probileb'): return self.probileb class BaseProfile(models.Model): class Meta: abstract = True user = models.OneToOneField(settings.AUTH_USER_MODEL) class ProfileA(BaseProfile, models.Model): # ... class ProfileB(BaseProfile, models.Model): # ... -
how to sorted some shops by distance in django
I have latitude and longitude and I want to pull the record from the database mongodb, i want select all table sorted by distance model: class Location(DynamicDocument): type = fields.StringField() coordinates = fields.ListField(FloatField()) class Products(Document): picture = fields.StringField() name = fields.StringField() email = fields.StringField() city = fields.StringField() location = fields.EmbeddedDocumentField('Location') -
Django '/' only homepage url error
I am using Django 2.0 and now I have no idea how to make an 'empty' url for the homepage. Meaning, I want it to route for web.com/ or web.com. I tried this code but it does not work: urlpatterns = [ path('admin/', admin.site.urls), path('/', include('post.urls')) ] ...and post.urls urlpatterns = [ path('', views.index, name='index') ] And the error I get when I make a request to localhost:8000: Request URL: http://localhost:8000/ Using the URLconf defined in myblog.urls, Django tried these URL patterns, in this order: admin/ / The empty path didn't match any of these. I did sort of find a workaround by setting path to an empty string '' on both but I am not sure if it is recommended or what errors it might cause. Help is much appreciated. Thank you :-). -
how to render output from django view to angularjs app
I have a django view which is called using a angular frontend controller and an image is passed to it,and some processing is done on it and output is generated.now i want to render this output to angularjs app instead of giving it to my template.In other words i dont want to use any templates for rendering this output to user, but do it using angular. app.js $scope.segmentImage = function(image) { $http({method:'POST', url:'http://127.0.0.1:8000/image/script_function/', data:{'image': image}}) .then(function successCallback(response) { console.log('Image Posted successfully') },function errorCallback(response) { console.log('Image Post failed') } )}; views.py from django.shortcuts import render def segment_image(request): if request.method == 'GET': form = segment_form() else: if form.is_valid(): info = request.POST['info_name'] output = script_function(info) ''' Here i am calling script_function,passing the POST data info to it''' return render(request, 'your_app/your_template.html', { 'output': output, }) return render(request, 'your_app/your_template.html', { 'form': form, }) '''here info is our image in some format''' def script_function(info): '''here goes my main logic''' x=y=w=h=102 return x,y,w,h -
How to automate Django-App_EXE created by using pyinstaller and innosetup
I have created an EXE file for my django application. After creating EXE each and everytime i need to run EXE by command line for example : mysite.exe runserver To be more detailed : OS: windows(CMD), Used pyinstaller to pack all deppendency softwares and later innosetup to make installer. I have tried to create a batch file to automate the EXE run as given below: SET PATH=%PATH%;C:\Program Files (x86)\cook_cake\; start http://localhost:8000 & C:\"Program Files (x86)"\cook_cake\cookie_cake.exe runserver This batch script is not producing desired result.Even this batch script has to run in background when i click on application. My assumption is error is there in batch script.