These are chat archives for django/django

26th
Apr 2016
Asif Saif Uddin
@auvipy
Apr 26 2016 06:27
@chessbr your need to read django models migrations more I believe before any serious deployment.
sumit sinha
@sumitsinha91
Apr 26 2016 07:52
ImportError: No module named webob
i am getting this error
can anyone help me why
my runserver is runing but when i am using for test so i ma getting this type of problem
like- python manage.py test tests --keepdb
Filip Figiel
@megapctr
Apr 26 2016 08:56
@andela-jngatia serialize these messages into a js object inside a <script> tag in your template, then read it in your react component
@sumitsinha91 you have to install webob to use webob
are you using python 2.7?
try adding from __future__ import absolute_import in the file that fails to import webob
Asif Saif Uddin
@auvipy
Apr 26 2016 08:59
@sumitsinha91 try pip/pip3 install webob
Filip Figiel
@megapctr
Apr 26 2016 08:59

The problem with 2.7 imports is, if you have a structure like this:

.
├── module.py
└── test
    └── module.py

and in your test/module.py file you try to import something from module

sheepsy90
@sheepsy90
Apr 26 2016 09:00
If i have a set of view functions that all do the same despite calling a different model how would I generalize that to have only one Definition and give in the 'pointer' to the model class. I looked into class based views but they seem to rather encapsule one view function that should be reused. But i want to avoid to write 20 viewclasses for each view function one to then use each of them in 3 places
Filip Figiel
@megapctr
Apr 26 2016 09:00
2.7 will try to import something from test.module first. that's what absolute_import fixes
@sheepsy90 you can write a function that takes a model, and returns the function which uses the given model
def do_thing_with_model(model):
  def do_thing(*args):
    return model.whatever(*args)
  return do_thing
sheepsy90
@sheepsy90
Apr 26 2016 09:03
Can i put do thing wird model into the urls mapping?
Filip Figiel
@megapctr
Apr 26 2016 09:03
then you can do_with_bar = do_thing_with_model(Bar)
you'd have to write a function that returns a valid url object, but yes
sheepsy90
@sheepsy90
Apr 26 2016 09:04
Okay thats the closure idea should work
:)
Filip Figiel
@megapctr
Apr 26 2016 09:04
good luck!
sumit sinha
@sumitsinha91
Apr 26 2016 10:02
hello fliip
my structure is as your example
-tests
-tests
     - __init__.py
     - party.py
     - view.py
     - models.py
     - api.py
this type of structure in my app
sumit sinha
@sumitsinha91
Apr 26 2016 10:08
i have import party.py in init.py
Christian Hess
@chessbr
Apr 26 2016 10:13
@auvipy yes, I know. I was facing a circulardependency error. Now I've understand how it works, I solved my problem. Thank you guy, I were just a little bit confused.
sumit sinha
@sumitsinha91
Apr 26 2016 10:19
now i am getting this error
OSError: [Errno 2] No such file or directory
Mir Nazim
@mnazim
Apr 26 2016 10:20
@sumitsinha91 Share the full traceback
sumit sinha
@sumitsinha91
Apr 26 2016 10:34
ERROR: test_stream_upload_generator_no_len (tests.test_streaming.TestStreamingHTTPS)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/oms/local/lib/python2.7/site-packages/tests/test_streaming.py", line 38, in setUp
    self.server_proc = subprocess.Popen(cmd, stdout=self.server_output, stderr=self.server_output, close_fds=True)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

----------------------------------------------------------------------
Ran 45 tests in 0.074s

FAILED (errors=22)
Preserving test database for alias 'default'...
(oms) sumit@sumit:/srv/honeycom$
Filip Figiel
@megapctr
Apr 26 2016 11:24
check value of your cmd
it's invalid so subprocess fails to execute a command
araksin
@araksin
Apr 26 2016 14:49
This message was deleted
Can someone explain what is happening when i initialize Celery() app with no arguments and running something using it's task decorator(from network browser inspector that makes my tasks work in queue unlike simple executing)? There's a default broker in celery?
mpachas
@mpachas
Apr 26 2016 15:08
You have to install and start the broker service (for example: rabbitmq) and config the BROKER_URL parameter in settings.py
gmwill92
@gmwill92
Apr 26 2016 17:25
Anyone knows a good tutorial on how to implement charts & graphs with django?
Christian Hess
@chessbr
Apr 26 2016 20:31
@gmwill92 have you tried matplotlib ( http://matplotlib.org/ )?
Mir Nazim
@mnazim
Apr 26 2016 20:33
@gmwill92 Other option is to generate data from django and use something like D3.js for visualizations.
Google charts API is also an option.
Christian Hess
@chessbr
Apr 26 2016 20:34
yeah, that is good too
Affan Sadiq
@affansadiq
Apr 26 2016 23:17
@shaleh thanks ! :)