Data dodania Pytanie
2017-06-16 23:06 How to serve static files using Nginx and Django on Docker? »
I've read some posts about this issue on StackOverflow already but couldn't fix my issue with them, as the title says I'm trying to serve static using...
(1) odpowiedzi
2017-06-16 22:06 Python 3: AttributeError: 'str' object has no attribute 'remove' »
This code isn't working for me: def _a(the_list, val): while val in the_list: the_list.remove(val) the resulting error is: AttributeEr...
(1) odpowiedzi
2017-06-16 21:06 Algorithm to find disconnected graph from sets »
Goal: Want to efficiently find all the disconnected graphs from a large collection of sets For example, I have a data file like the following: A, B,...
(3) odpowiedzi
2017-06-16 20:06 Can I change the way keys are compared in a Python dict? I want to use the operator 'is' instead of == »
Let's say I have two objects of a same class: objA and objB. Their relationship is the following: (objA == objB) #true (objA is objB) #false ...
(2) odpowiedzi
2017-06-16 19:06 ValueError at /admin/zinnia/entry/add/ in Zinnia? »
When adding an entry using the admin site in Zinnia app in Django I get the following error? ValueError at /admin/zinnia/entry/add/ too many values ...
(2) odpowiedzi
2017-06-16 18:06 With SQLAlchemy, how can I convert a row to a "real" Python object? »
I've been using SQLAlchemy with Alembic to simplify the database access I use, and any data structure changes I make to the tables. This has been wor...
(1) odpowiedzi
2017-06-16 16:06 python 3.5 selecting and using results from postgres database »
I need to write a program which can,firstly, for ip adresses of people who saw my campaign on google, and then give me detailed information about each...
(2) odpowiedzi
2017-06-16 15:06 Django/AngularJS: CSFR Token Error »
I'm new to both Django and AngularJS and I've been struggling on this for hours. AngularJS Code (of my controller) to POST to Django Server: $http({...
(2) odpowiedzi
2017-06-16 06:06 What is a good way to layer like this in pygame? »
I've been working on a small project in pygame. It's an overhead 2D game, but if a player is behind an object, I need the player to be one layer behin...
(2) odpowiedzi
2017-06-16 02:06 What is the most pythonic way to re-order a class objects' attributes? »
I'm in the process of creating a set of Python 2.7/3+ tools to programmatically modify the contents of XML files my team uses constantly. So far, I'm ...
(2) odpowiedzi
2017-06-16 01:06 Vectorized version of finding the maximum positive value or else the minimum negative value »
Let's say I have a pandas DataFrame called purity_list as follows: In[]: purity_list Out[]: 48 49 50 2 0.1 0.9 0.3 A 0.2 -0.5 -...
(1) odpowiedzi
2017-06-15 20:06 I can't remove the last comma »
I'm working through 'Automate the Boring Stuff with Python'. I can't figure out how to remove the final output comma from the program below. The goal ...
(6) odpowiedzi
2017-06-15 13:06 Why are instances of old style classes instances of `object`? »
In Python 2, why are instances of old style classes still instances of object even when they do not explicitly inherit from object? class OldClass: ...
(0) odpowiedzi
2017-06-15 13:06 Understanding the max function operation on Python dictionary »
I am trying to understand the operation on max function on Python dictionary. Following is the code I am using: tall_buildings = { "Empire State...
(3) odpowiedzi
2017-06-15 10:06 Django resets connection on some requests »
I stub with problem that when sending some requests to Django sever, it closes connection before time. Here is simple project on Github Here is how...
(2) odpowiedzi
2017-06-15 08:06 Python writelines() and write() huge time difference »
I was working on a script which reading a folder of files(each of size ranging from 20 MB to 100 MB), modifies some data in each line, and writes back...
(3) odpowiedzi
2017-06-15 08:06 Thread1:EXC_BAD_INSTRACTION »
I got an error Thread1:EXC_BAD_INSTRACTION. I am making Swift app and I wanna make a system in my app which upload a image to my Django server. When I...
(2) odpowiedzi
2017-06-15 00:06 factory_boy extract original kwargs »
I'm building a factory with factory_boy that generates a django model. I would like to see what arguments the user inputs inline. My factory itself lo...
(1) odpowiedzi
2017-06-14 23:06 How to do a cumulative "all" »
Setup Consider the numpy array a >>> np.random.seed([3,1415]) >>> a = np.random.choice([True, False], (4, 8)) >>> a array...
(1) odpowiedzi
2017-06-14 15:06 OneToMany Relationship for more generic django apps »
I'm trying to figure out how to genereate a one-to-many relation ship (i.e. a "list of objects for one model to the other) without having to use a for...
(2) odpowiedzi
2017-06-14 14:06 Python - easy way to "comparison" map one array to another »
I have an array a = [1, 2, 3, 4, 5, 6] and b = [1, 3, 5] and I'd like to map a such that for every element in a that's between an element in b it will...
(2) odpowiedzi
2017-06-14 08:06 How to make a dictionary of dictionaries with multiple lists »
There is one index list which will be the key of the parent dictionary: index = [1,2,3] and then multiple lists of which will be the child dicts: ...
(7) odpowiedzi
2017-06-14 08:06 Trying to send value from javascript to python server »
I have multiple input tags, my task is to collect the values entered by the user and send it back to the server. I am using Django as my framework. I ...
(1) odpowiedzi
2017-06-13 22:06 When does __eq__ gets called using hash()? »
As mentioned here, Below code, class Person(object): def __init__(self, name, ssn, address): self.name = name self.ssn = ssn ...
(2) odpowiedzi
2017-06-13 20:06 Filtering Django QuerySet based on ManyToMany relationship existence »
The Models Here is the basic models setup we have. A List has many Items, and an Item can be in many Lists. For a given Item, if any of its Lists ar...
(1) odpowiedzi
2017-06-13 19:06 Django form not saving password when creating user »
I have made a custom form for my django app which allows users to register themselves for the website. This is the form for my django app: class Tea...
(3) odpowiedzi
2017-06-13 17:06 python3: Using ternary operator in map, it will return None »
For python 2.7.13 >>> lst_ = [1] >>> map(lambda x, y: x + y if y else 1, lst_, lst_[1:]) [1] For python 3.6.1 >>> lst_ ...
(1) odpowiedzi
2017-06-13 14:06 Operator overloading in Python: handling different types and order of parameters »
I have a simple class that helps with mathematical operations on vectors (i.e. lists of numbers). My Vector can be multiplied by other instances of Ve...
(2) odpowiedzi
2017-06-13 13:06 Comparing the speed of startswith() .vs. in() »
I was under the impression that startswith has to be faster than in for the simple reason that in has to do more checks (allows for the word being loo...
(3) odpowiedzi
2017-06-12 15:06 Is there a way to list the attributes of a class without instantiating an object? »
In Python 3.5, say I have: class Foo: def __init__(self, bar, barbar): self.bar = bar self.barbar = barbar I want to get the li...
(3) odpowiedzi
2017-06-12 12:06 Convert datetime printed by Django, to a different datetime format »
My web application works with datetime(s) as timestamps, which according to Django's error messages need to be in the following format: YYYY-MM-DD HH:...
(3) odpowiedzi
2017-06-12 12:06 Can I lookup a related field using a Q object in the Django ORM? »
In Django, can I re-use an existing Q object on multiple models, without writing the same filters twice? I was thinking about something along the lin...
(2) odpowiedzi
2017-06-12 11:06 Why the dip in speed increase for generating 400,000,000 random numbers? »
I'm generating around 400,000,000 (400 million) random numbers in parallel on an Intel i7 with 4 cores (8 threads hyperthreaded) on macOS with 8 GB RA...
(0) odpowiedzi
2017-06-12 09:06 PostgreSQL - Psycopg2 - copy_from - Invalid byte sequence for encoding "UTF8": 0x00 »
I want to insert bytes into my PostgreSQL (9.5.7) database column with the type bytea, using the Psycopg2 (2.7.1) copy_from() method. I can insert my...
(2) odpowiedzi
2017-06-12 01:06 Union of 2 sets does not contain all items »
How come when I change the order of the two sets in the unions below, I get different results? set1 = {1, 2, 3} set2 = {True, False} print(set1 | se...
(4) odpowiedzi