Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How can i get list of news_id from manytomanyfield table in django?
class news(models.Model): category = models.ForeignKey(category, on_delete=models.CASCADE) source = models.ForeignKey(source, on_delete = models.CASCADE) headlines = models.TextField(blank=True, null=True) description = models.TextField(blank=True, null=True) site = models.URLField(null=True) story = models.TextField(blank=True, null=True) datetime = models.CharField(blank=True, max_length=255) image_url = models.URLField(blank=True, null=True) favourite = models.ManyToManyField(User, related_name='favourite', blank=True) ----------------- news_favourite table has id, news_id, user_id I want to perform query like select news_id from news_favourite where user_id= 1 (or it can be any user_id). -
Django exception Issue [closed]
So I have a view which creates a form, saves info from the form and accepts a payment string from payment provider. Here is the code: if request.method == 'GET': #Step 1: create form elif request.method == 'POST': try: #Step 2: get form with inputs if form.is_valid(): #Step 2.1: save info except: # there is no form. #Step 3: I accept the query set from payment provider with transaction confirmation In the last step nothing happens. I've spent like 3 yours, but still can't fix the issue. -
How to do user authentication in django when using windows (crypt module is not supported on windows)
I was trying to register user in django using User model from 'django.contrib.auth.models', but when encrypting password, it shows 'The crypt module is not supported on Windows'. Also I tried importing from passlib.hash the pbkdf2_sha256 to encrypt the data. serializers.py class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'username', 'email') class RegisterSerializer(serializers.ModelSerializer): class Meta: model = User fields = ['id', 'username', 'email', 'password'] extra_kwargs = {'password': {'write_only': True}} def create(self, validated_data): encryptedpass = pbkdf2_sha256.encrypt(validated_data['password'], rounds=12000, salt_size=32) user = User.objects.create_user(username=validated_data['username'], email=validated_data['email'], password=encryptedpass) return user views.py class RegisterAPI(generics.GenericAPIView): serializer_class = RegisterSerializer def post(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) user = serializer.save() return Response({ "user": UserSerializer(user, context=self.get_serializer_context()).data, "token": AuthToken.objects.create(user)[1] }) class LoginAPI(KnoxLoginView): permission_classes = (permissions.AllowAny,) def post(self, request, format=None): encryptedpass = pbkdf2_sha256.encrypt(request.data['password'], rounds=12000, salt_size=32) mydata = {'username':request.data['username'], 'password':encryptedpass} serializer = AuthTokenSerializer(data=mydata) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] login(request, user) return super(LoginAPI, self).post(request, format=None) # Get User API class UserAPI(generics.RetrieveAPIView): permission_classes = [permissions.IsAuthenticated,] serializer_class = UserSerializer def get_object(self): return self.request.user But during authentication in login part, it does not match the credentials, maybe because the function checking for validity uses some other encryption method. How to solve this issue. -
Django: Filter data between to dates | DatetimeField received a naive datetime
I simply want to filter my records between two dates. Let's say there is a record table Measurements that has the property timestamp: class Measurements(models.Model): id = models.BigAutoField(primary_key=True) timestamp = models.DateTimeField() When I checked the timestamp of the last record Measurements.objects.last().timestamp it returns: datetime.datetime(2020, 10, 13, 6, 29, 48, 90138, tzinfo=<UTC>) Now I want to filter the data between to dates from_date and to_date. According to previous questions about this issue, I used make_aware. For testing I used count to get the amount of entries. from .models import * from datetime import datetime from django.utils.timezone import make_aware def get_measurements(request): from_date = make_aware(datetime(2020, 10, 12, 15, 30, 0, 0)) to_date = make_aware(datetime(2020, 10, 12, 16, 0, 0, 0)) print(from_date) print(to_date) measurements = DriveMeasurements.objects.filter( plc_timestamp__range=["2020-01-01", "2020-01-31"]) print(measurements.count()) When printing the two dates in my shell, it returns: datetime.datetime(2020, 10, 12, 15, 30, tzinfo=<UTC>) datetime.datetime(2020, 10, 12, 16, 0, tzinfo=<UTC>) When I run the function above, Django fires the following message: RuntimeWarning: DateTimeField Measurements.timestamp received a naive datetime (2020-01-31 00:00:00) while time zone support is active. warnings.warn("DateTimeField %s received a naive datetime (%s)" The print statement print(measurements.count()) prints 0 but there are ~ 18000 records in the database. So why is the filter … -
curl: (6) Could not resolve host: Token
I'm trying to make a Django and Vue.js Chat application. I used Django rest framework. I installed them using pip. I've created user using djoser. When I'm trying to run this in cmd to get the created user details ---> curl -LX GET http://127.0.0.1:8000/auth/users/me/ -H 'Authorization: Token ae44f43cbb2a9444ff4be5b75e60a712e580902c' ,I'm getting curl: (6) error Below is the Django views.py file : """Views for the chat app.""" from django.contrib.auth import get_user_model from .models import ( ChatSession, ChatSessionMember, ChatSessionMessage, deserialize_user ) from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import permissions class ChatSessionView(APIView): """Manage Chat sessions.""" permission_classes = (permissions.IsAuthenticated,) def post(self, request, *args, **kwargs): """create a new chat session.""" user = request.user chat_session = ChatSession.objects.create(owner=user) return Response({ 'status': 'SUCCESS', 'uri': chat_session.uri, 'message': 'New chat session created' }) def patch(self, request, *args, **kwargs): """Add a user to a chat session.""" User = get_user_model() uri = kwargs['uri'] username = request.data['username'] user = User.objects.get(username=username) chat_session = ChatSession.objects.get(uri=uri) owner = chat_session.owner if owner != user: # Only allow non owners join the room chat_session.members.get_or_create( user=user, chat_session=chat_session ) owner = deserialize_user(owner) members = [ deserialize_user(chat_session.user) for chat_session in chat_session.members.all() ] members.insert(0, owner) # Make the owner the first member return Response ({ 'status': 'SUCCESS', 'members': members, … -
How to get data by filtering with two different dates in django?
This is my model; class FundData(models.Model): fund = models.ForeignKey(Fund, on_delete=models.CASCADE, related_name="data_of_fund", verbose_name="Fund") date = models.DateField(auto_now_add=False, editable=True, blank=False, verbose_name="Date") price = models.FloatField(max_length=15, blank=False, verbose_name="Fund Price") This is my frontend where i want to choose dates; <div class="col-12 d-flex align-items-end"> <div> <label>Starting Date</label> <input id="startDatePicker" type="text" class="form-control datepicker" autocomplete="off"> </div> <div class="mx-2"> <label>Ending Date</label> <input id="endDatePicker" type="text" class="form-control datepicker" autocomplete="off"> </div> <a onclick="getFundReturnsByDate()" class="btn btn-info" href="javascript:void(0);"> Show<i class="fas fa-caret-right"></i></a> </div> All i want is that user should choose 2 dates and bring the data of the selected dates in a table. Any help is appreciated, thanks! -
Django Dashboard with Node.js
I am trying to build a Django app and currently, I wanted to program to shut down my server directly from a button and Rebooting from a separate button. html code..... <button onclick="powerOff()" class="button">Power Off</button> <p id="poweroff"></p> <button onclick="reboot()" class="Reboot">Reboot</button> <p id="reboot"></p> Javascript code:... <script> function powerOff() { if (confirm("Are you sure you want to power off ?")) { require('child_process').exec('sudo shutdown -r now', function (msg) { console.log(msg) }); } } function reboot() { if (confirm("Are you sure you want to reboot ?")) { } else { } </script> When I am running this code directly from my terminal it is functioning but it is not executing from the app. -
Django Custom Manager to dynamically filter archived objects
Suppose I have a model: class Car(models.Model): name = models.CharField(max_length=50) is_active = models.BooleanField(default=True) When I query on Car, I always want to return the objects satisfying, is_active=True. For this, searching on StackOverFlow, I get that my best bet is to use ModelManager, like this: class CarManager(models.ModelManager): def get_queryset(self): return super().get_queryset().filter(is_active=True) And, use this Manager in my model. class Car(models.Model): name = models.CharField(max_length=50) is_active = models.BooleanField(default=True) objects = CarManager() Using this solution always returns active Car queryset. But, sometimes I want to return inactive Car queryset as well, and I don't want to write another ModelManager. To elaborate, When I run, Car.objects.all() or, Car.objects.filter(name__contains='Car') or, Car.objects.filter(is_active=True) I only want active Car queryset. When I run, Car.objects.filter(is_active=False) I want to have inactive Car queryset. And, I want to achieve this using single ModelManager and default methods (get, filter, all, etc). Why I want this is because, it has been used in many places already. So, is there any way to achieve this? Any suggestions or insights are heartily welcome. Thanks for your help in advance. -
Many views in one template? [django]
I have Article model: class Article(Created, HitCountMixin): title = models.CharField(max_length=120) author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) snippet = models.TextField(null=False) hit_count_generic = GenericRelation( MODEL_HITCOUNT, object_id_field='object_pk', related_query_name='hit_count_generic_relation') and I have couple views for this model like: 1) class AllArticlesListView(ListView): template_name = 'news/articles_list.html' model = Article paginate_by = 5 def get_queryset(self): return self.model.objects.all().order_by('-pk') 2) class MostPopularArticleListView(ListView): template_name = 'news/articles_list.html' model = Article def get_queryset(self): return self.model.objects.all().order_by('-hit_count_generic__hits')[:5] and others... Is there possibility to show all views in one template? -
Django: How can I display the original filename of an Uploaded file in HTML?
I want to show the exact filename of a user-uploaded file in a page, but I haven't found a sort of out-of-the-box way to do it, and I'd like to know if it exists or what could be a better way to do it. 1.- I can't split a string with Django's template language. I found there is a truncatechars filter, but that won't work for me because filenames have different lengths and, if they get truncated, I get an ellipsis at the end. 2.- In the only answer to this question, the user says FileField objects have a filename attribute. However, there is no filename attribute defined here or here and, actually, if I do the same ModelObject.field_name.filename, I get AttributeError: 'FieldFile' object has no attribute 'filename'. Possible solutions I have found: I see I can define a custom template filter that can do string.split('/')[-1], but I'm not sure if that's kind of an overkill for this. Also, note that, if this method is used, I could end up showing the user a different filename in the case in which they uploaded a file with the same name of an existing file in their user directory inside the media … -
Crontab - Django ERROR: /bin/sh: /usr/bin/crontab: File or directory does not exist
I am working on a Django project that runs a crontab task to feed it's database. The problem shows when I try to add the crontab job before running the django server: COMMAND: (venv) python manage.py crontab add ERROR: /bin/sh: /usr/bin/crontab: File or directory does not exist adding cronjob: (d99f11ab3bcd8ffb80a4a4f3b76cb35c) -> ('0,20,40 * * * *','data.cron.feed_database') sh: /usr/bin/crontab: File or directory does not exist Django SETTINGS: CRONJOBS = [ ('0,20,40 * * * *', 'data.cron.feed_database'), ] Here are my crontab files: crontab -e # m h dom mon dow command SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/crontab 0,20,40 * * * * /home/mote/Desktop/CODE/ORION/djangorion/venv/bin/python /home/mote/Desktop/CODE/ORION/djangorion/manage.py crontab run d99f11ab3bcd8ffb80a4a4f3b76cb35c #django-cronjobs for orion sudo crontab -e "Empty" Any suggestions? Thanks. -
Get scheduled events for a specific interval
I have a series of events, set by their frequency of occurrence, for example, weekly (like every Tuesday), monthly (every second number), etc. There is a start date for a sequence of events and an end date can be specified or omitted. eg: event = Event ( name = 'go to the office', startday = '13 .10.2020', schedule = Schedule (type ='weekly', details = {'day':' Tuesday'}) ) it is just an example interface, which can be adjusted if required by the tool The task itself is that I need to make a query with a certain start-end time interval and get all the events in the interval. Therefore, the question is, are there any libraries that solve such problems, or I have to reinvent the wheel? I have to do it in Django based project, so if Django based solution is more convenient. -
CBV using django-filter with django-table2
I want to use django-table2 with django-filter. I done what django-table2 document said but form of django-filter didn't display in my template. These are my codes: # Views.py from django_filters.views import FilterView import django_filters from django_tables2 import SingleTableView class MYFilter(django_filters.FilterSet): class Meta: model = MyModel fields = ['field1 'field2' ] class MyView(SingleTableView, FilterView): model = MyModel table_class = MyTable template_name = 'my_template.html' filterset_class = MYFilter # tables.py import django_tables2 as tables class MyTable(tables.Table): class Meta: model = MyModel fields = ("field1", "field2",) # my_template.html {% load render_table from django_tables2 %} {% if filter %} <form method="get"> {{ filter.form.as_p }} <input type="submit" /> </form> {% endif %} {% if table %} <div class="table-responsive"> {% render_table table %} </div> {% endif %} The table render correctly, but the form didn't render. What's wrong with my code? -
Django: filter first items, based on ForeignKey
Let's say I have this models (mariaDB): class MediaSeries(models.Model): name = models.CharField(max_length=200) description = models.TextField(blank=True) class MediaFiles(models.Model): entryNr = models.IntegerField(default=0, help_text="number of episode") name = models.CharField(max_length=300) serie = models.ForeignKey(MediaSeries, null=True, on_delete=models.SET_DEFAULT) MediaFiles can be a single entry, or a part of a series. When it is a part of a series, it will have an unique entryNr. The entryNr can start with any number, not only from 1. I need now a filter method to filter all Mediafiles entries, what is part of an series, but only the first entry. For example I have this raw list: {"entryNr": 0, "name": "test a1", "serie": 0}, {"entryNr": 2, "name": "test b1", "serie": 1}, {"entryNr": 3, "name": "test b2", "serie": 1}, {"entryNr": 4, "name": "test b3", "serie": 1}, {"entryNr": 1, "name": "test c1", "serie": 2}, {"entryNr": 2, "name": "test b1", "serie": 2}, {"entryNr": 5, "name": "test d1", "serie": 3}, {"entryNr": 6, "name": "test d2", "serie": 3}, {"entryNr": 7, "name": "test d3", "serie": 3}, {"entryNr": 0, "name": "test e1", "serie": 0}, {"entryNr": 0, "name": "test f1", "serie": 0} And the result I need should be: {"entryNr": 2, "name": "test b1", "serie": 1}, {"entryNr": 1, "name": "test c1", "serie": 2}, {"entryNr": 5, "name": "test d1", … -
Django get user object at forms.py
I'm dealing with a form where need to check the users pin input but I'm unable to receive the user object. When I'm calling the form I running into the following issue: TypeError: init() got an unexpected keyword argument 'user' forms.py: class RequestPinAuth(forms.Form): error_messages = { 'user_or_pin_mismatch': _('Wrong PIN entered, please try again') } pin = forms.CharField(min_length=4, max_length=6, widget=forms.PasswordInput(attrs={'autocomplete': 'off'})) captcha = CaptchaField() def __init__(self, *args, **kwargs): super(RequestPinAuth, self).__init__(*args, **kwargs) self.user = kwargs.pop('user') self.fields['pin'].widget.attrs.update({'class': 'pin-input'}) self.fields['pin'].label = 'PIN' self.fields['pin'].help_text = mark_safe( "<h4 class='help_text'>Enter your PIN for verification</h4>") def clean(self): user_pin = self.cleaned_data.get('pin') try: user = User.objects.get(user=self.user) if user_pin != user.pin: raise forms.ValidationError( self.error_messages['user_or_pin_mismatch'], code='user_or_pin_mismatch', ) except: raise forms.ValidationError( self.error_messages['user_or_pin_mismatch'], code='user_or_pin_mismatch', ) At views.py I'm calling my form like so: pin_form = RequestPinAuth(user=request.user) -
Export xlsx file with model having reverse foreign key relation and make that reverse foreign key relation as separate column
I am using django import_export package for export my data into xlsx file. I am having issue while exporting the data to excel in the format I need. models.py class Fans(models.Model): """ Model for survey answering people """ fan_id = models.AutoField(db_column='FAN_ID', primary_key=True) first_name = models.CharField( db_column='FIRST_NAME', max_length=45, blank=True, null=True) last_name = models.CharField( db_column='LAST_NAME', max_length=45, blank=True, null=True) phone = models.CharField( db_column='PHONE', max_length=45, blank=True, null=True) email = models.CharField( db_column='EMAIL', max_length=45, blank=True, null=True) gender = models.CharField( db_column='GENDER', max_length=45, blank=True, null=True) class Responses(models.Model): """ Model for responses given by fans """ survey = models.ForeignKey( Surveys, on_delete=models.CASCADE, db_column='SURVEY_ID', related_query_name="part") fan = models.ForeignKey(Fans, on_delete=models.CASCADE, db_column='FAN_ID', related_query_name="given", related_name="given") survey_question = models.ForeignKey( SurveyQuestions, on_delete=models.DO_NOTHING, db_column='SURVEY_QUESTION_ID', related_query_name="response") response = models.CharField( db_column='RESPONSE', max_length=255, blank=True, null=True) correct_answer = models.IntegerField( db_column='CORRECT_ANSWER', blank=True, null=True) load_id = models.IntegerField(db_column='LOAD_ID', blank=True, null=True) class SurveyQuestions(models.Model): """ Model for surveys questions """ survey = models.ForeignKey(Surveys, on_delete=models.CASCADE, db_column='SURVEY_ID', related_query_name="question") survey_question_id = models.AutoField( db_column='SURVEY_QUESTION_ID', primary_key=True) survey_question_name = models.CharField( db_column='SURVEY_QUESTION_NAME', max_length=255) question = models.CharField( db_column='QUESTION', max_length=255, blank=True, null=True) response_type = models.CharField( db_column='RESPONSE_TYPE', max_length=255, blank=True, null=True) load_date = models.DateField(db_column='LOAD_DATE', auto_now_add=True) I want to export data of the fans with recorded responses in the following format: first_name, last_name, phone, email, question1, question2, question3 abc, xyz, 1234566780, abc@gmail.com, response1, response2, response3 Here, the first … -
Create and Update Nested Django Model instances
I have two models User and CompanyDetails. User model has a field called company which is a foreign key from model CompanyDetails. I am trying to write a ModelSerializer for the above stated models which will have update and create methods as show below - class RegisterUserSerializer(serializers.ModelSerializer): ''' This serializer is for Register User view. ''' company = CompanyDetailsSerializer() class Meta: model = User fields = ['id', 'first_name', 'last_name', 'email', 'mobile_number', 'company', 'password'] extra_kwargs = { 'first_name' : { 'required' : True, 'allow_null' : False, 'allow_blank' : False }, 'last_name' : { 'required' : True, 'allow_null' : False, 'allow_blank' : False }, 'email' : { 'required' : True, 'allow_null' : False, 'allow_blank' : False }, 'mobile_number' : { 'required' : True, }, 'password' : { 'required' : True, 'allow_blank' : False, 'allow_null' : False, 'write_only': True, # 'editable':False, 'read_only':False } } @transaction.atomic def create(self, validated_data): company = validated_data.pop('company') user_group = validated_data.pop('user_group') user_group = Group.objects.get(name=user_group) company = CompanyDetails.objects.create(**company) validated_data['company'] = company user = User.objects.create_user(**validated_data) user_and_group = user.groups.add(user_group) return user def update(self, instance, validated_data): instance.first_name = validated_data.get('first_name', instance.first_name) instance.last_name = validated_data.get('last_name', instance.last_name) instance.email = validated_data.get('emai', instance.email) instance.mobile_number = validated_data.get('mobile_number', instance.mobile_number) instance.company.company_name = validated_data.pop('company['company_name]', instance.company) instance.save() return instance The create method of serializer … -
Django admin list_filter: RelatedFieldListFilter based on user
The question is similar to Django "list_filter" based on the admin queryset. I need to use list_filter based on current user. But in my case the field span relations using the __ lookup. There is no useful "lookups" method on RelatedFieldListFilter. My approach resulted in the next code: def custom_titled_filter(title): class Wrapper(admin.FieldListFilter): def __new__(cls, field, request, *args, **kwargs): instance = admin.FieldListFilter.create(field, request, *args, **kwargs) instance.title = title rel_model = field.remote_field.model qs = rel_model._default_manager.all() if not request.user.is_superuser: qs = qs.filter(user=request.user) choice_func = operator.attrgetter( field.remote_field.get_related_field().attname if hasattr(field.remote_field, 'get_related_field') else 'pk' ) instance.lookup_choices = [ (choice_func(x), str(x)) for x in qs ] return instance return Wrapper Is there any better approach with current version of Django? -
django.db.utils.ProgrammingError: (1146, "Table 'djangodatabase.auth_permission' doesn't exist")
I drop some tables in mysql databse which includes one of the table named auth_permission. However, this table wasnt manually created in dango, ie, it dosent have a model in django. Now I run the makemigrations and then migrate, then it shows this error. What I am supposed to do. All tables were added after migrations except this. I didnt create this table. -
Django project not in virtual environtment folder?
I was cloning django project, then i try to run the project that next step is to install virtual environtment. I was confusing because usually project is in the virtual environtment folder(see the pic) but it is not, althought the project run properly. Anybody can explain? This is my project layout -
Edit formdata in Django Rest framework
I have a simple form in my app which contains manytomany field and an document uploader. The data in this form is being sent as multipart/form-data for e.g. transaction_no: 5001 document: (binary) items: [{"product":1,"quantity":"12","fault":"Repairable"}] allotment: 2 The create function works perfectly fine but when I try to edit the data in this form I get an error The data sent during "editing" is similar to the data sent during "creation". data: transaction_no: 5001 items: [{"id":5,"quantity":"10","fault":"Repairable","product":1}] allotment: 2 Serializer.py class DeliveredItemsSerializer(serializers.ModelSerializer): class Meta: model = DeliveredItems fields = "__all__" class DeliveredSerializer(serializers.ModelSerializer): items = DeliveredItemsSerializer(many=True, required=False) class Meta: model = Delivered fields = "__all__" def create(self, validated_data): items_objects = validated_data.pop('items', None) prdcts = [] try: for item in items_objects: i = DeliveredItems.objects.create(**item) prdcts.append(i) instance = Delivered.objects.create(**validated_data) instance.items.set(prdcts) return instance except: instance = Delivered.objects.create(**validated_data) return instance def update(self, instance, validated_data): items_objects = validated_data.pop('items',None) prdcts = [] for item in items_objects: print("item", item) fk_instance, created = DeliveredItems.objects.update_or_create(pk=item.get('id'), defaults=item) prdcts.append(fk_instance.pk) instance.items.set(prdcts) instance = super(DeliveredSerializer, self).update(instance, validated_data) return instance Error: 'NoneType' object is not iterable and this is the line of error: for item in items_objects: How come when I am sending the same data in exact same format is not received by the serializer during … -
LEFT JOIN in Django ORM (left join bettwen two tables and stock the result in a third table)
I have the following models: class Somme_Quantity_In_T(models.Model): Family_Label = models.CharField(max_length=50) Site = models.CharField(max_length=10) Product = models.CharField(max_length=10) Vendor = models.CharField(max_length=200) class Produit(models.Model): Taux = models.CharField(max_length=50, null=True) Famille = models.CharField(max_length=50) NIP = models.CharField(max_length=50) NGS = models.CharField(max_length=5, null=True) class Produit_a_ajouter(models.Model): Family_Label = models.CharField(max_length=50) Site = models.CharField(max_length=10) Product = models.CharField(max_length=10) Vendor = models.CharField(max_length=200) I want to query for this following query: SELECT Somme_Quantity_In_T.* FROM Somme_Quantity_In_T LEFT JOIN Produit ON Somme_Quantity_In_T.product = Produit.NIP AND Somme_Quantity_In_T.Family_Label = Produit.Famille WHERE Produit.NIP is null And I want to stock the result of this query in Produit_a_ajouter table -
How to reuse a big, expensive-to-load dictionary in Python?
I've got a 1 GB dictionary that takes a while to load into memory. But once the loading process is complete, running lookups in that dictionary is pretty fast. How do I best reuse that loaded dictionary from various Python scripts that may get spawned in response to network requests? I'd be interested in either general-purpose solution that I can test locally on my laptop before deploying to my Django server or, if there's none, in a Django-specific one. -
Requirement not fulfiled at heroku
I am getting the error while deploying Django project on heroku. ERROR: Could not find a version that satisfies the requirement apturl==0.5.2 (from -r /tmp/build_3724e729_/requirements.txt (line 1)) (from versions: none) ERROR: No matching distribution found for apturl==0.5.2 (from -r /tmp/build_3724e729_/requirements.txt (line 1)) I tried reinstalling apturl and I can see below- unpacking aptutl 0.5.2 but still I am getting error at heroku. sudo apt-get install apturl apturl-common Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: efibootmgr libboost-program-options1.65.1 libegl1-mesa libfwup1 libgoogle-perftools4 libllvm9 libpcrecpp0v5 libtcmalloc-minimal4 libwayland-egl1-mesa libyaml-cpp0.5v5 linux-headers-5.4.0-45-generic linux-hwe-5.4-headers-5.4.0-42 linux-hwe-5.4-headers-5.4.0-45 linux-image-5.4.0-45-generic linux-modules-5.4.0-45-generic linux-modules-extra-5.4.0-45-generic mongo-tools mongodb-server-core Use 'sudo apt autoremove' to remove them. Suggested packages: libgtk2-perl The following NEW packages will be installed: apturl apturl-common 0 upgraded, 2 newly installed, 0 to remove and 52 not upgraded. Need to get 19.4 kB of archives. After this operation, 228 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apturl-common amd64 0.5.2ubuntu14.2 [10.9 kB] Get:2 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apturl amd64 0.5.2ubuntu14.2 [8,464 B] Fetched 19.4 kB in 1s (31.2 kB/s) Selecting previously unselected package apturl-common. (Reading database ... 229913 files and directories currently installed.) Preparing to unpack .../apturl-common_0.5.2ubuntu14.2_amd64.deb … -
Why the python Tornado frame not have the start log like Flask or Django?
such as flask have Serving Flask app "main" (lazy loading) Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. Debug mode: off Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)