Re: ValueError at / Empty module name

2013-09-04 Thread Mantas Zilinskis
your problem is in TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.messages.context_processors.messages'
'django.contrib.auth.context_processors.auth'
)
it's a tuple, you have to have a comma after messages proccesor


On Wed, Sep 4, 2013 at 12:53 PM, Mantas Zilinskis  wrote:

> and also all your traceback
>
>
> On Wed, Sep 4, 2013 at 12:45 PM, Satinderpal Singh <
> satinder.goray...@gmail.com> wrote:
>
>> On Wed, Sep 4, 2013 at 11:11 PM, Mantas Zilinskis
>>  wrote:
>> > can you post your settings.py
>>
>> Here it is:
>>
>> # Django settings for nanaksar project.
>>
>> DEBUG = True
>> TEMPLATE_DEBUG = DEBUG
>>
>> ADMINS = (
>> # ('Your Name', 'your_em...@example.com'),
>> )
>>
>> MANAGERS = ADMINS
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.mysql', # Add
>> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
>> 'NAME': 'babaji',  # Or path to database
>> file if using sqlite3.
>> 'USER': '***',  # Not used with sqlite3.
>> 'PASSWORD': '***',  # Not used with sqlite3.
>> 'HOST': '',  # Set to empty string for
>> localhost. Not used with sqlite3.
>> 'PORT': '',  # Set to empty string for
>> default. Not used with sqlite3.
>> }
>> }
>>
>> # Local time zone for this installation. Choices can be found here:
>> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
>> # although not all choices may be available on all operating systems.
>> # On Unix systems, a value of None will cause Django to use the same
>> # timezone as the operating system.
>> # If running in a Windows environment this must be set to the same as your
>> # system time zone.
>> TIME_ZONE = 'America/Chicago'
>>
>> # Language code for this installation. All choices can be found here:
>> # http://www.i18nguy.com/unicode/language-identifiers.html
>> LANGUAGE_CODE = 'en-us'
>>
>> SITE_ID = 1
>>
>> # If you set this to False, Django will make some optimizations so as not
>> # to load the internationalization machinery.
>> USE_I18N = True
>>
>> # If you set this to False, Django will not format dates, numbers and
>> # calendars according to the current locale.
>> USE_L10N = True
>>
>> # If you set this to False, Django will not use timezone-aware datetimes.
>> USE_TZ = True
>>
>> # Absolute filesystem path to the directory that will hold user-uploaded
>> files.
>> # Example: "/home/media/media.lawrence.com/media/"
>> MEDIA_ROOT =
>> '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/'
>>
>> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
>> # trailing slash.
>> # Examples: "http://media.lawrence.com/media/";, "
>> http://example.com/media/";
>> MEDIA_URL = '/media/'
>>
>> LOCAL_URL = 'http://localhost/'
>>
>> # Absolute path to the directory static files should be collected to.
>> # Don't put anything in this directory yourself; store your static files
>> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
>> # Example: "/home/media/media.lawrence.com/static/"
>> STATIC_ROOT = ''
>>
>> # URL prefix for static files.
>> # Example: "http://media.lawrence.com/static/";
>> STATIC_URL = '/static/'
>>
>> # Additional locations of static files
>> STATICFILES_DIRS = ('/home/goraya/nanaksar/templates',
>> # Put strings here, like "/home/html/static" or
>> "C:/www/django/static".
>> # Always use forward slashes, even on Windows.
>> # Don't forget to use absolute paths, not relative paths.
>> )
>>
>> # List of finder classes that know how to find static files in
>> # various locations.
>> STATICFILES_FINDERS = (
>> 'django.contrib.staticfiles.finders.FileSystemFinder',
>> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
>> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
>> )
>>
>> # Make this unique, and don't share it with anybody.
>> SECRET_KEY = &

Re: ValueError at / Empty module name

2013-09-04 Thread Mantas Zilinskis
and also all your traceback


On Wed, Sep 4, 2013 at 12:45 PM, Satinderpal Singh <
satinder.goray...@gmail.com> wrote:

> On Wed, Sep 4, 2013 at 11:11 PM, Mantas Zilinskis
>  wrote:
> > can you post your settings.py
>
> Here it is:
>
> # Django settings for nanaksar project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> # ('Your Name', 'your_em...@example.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql', # Add
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'babaji',  # Or path to database
> file if using sqlite3.
> 'USER': '***',  # Not used with sqlite3.
> 'PASSWORD': '***',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '',  # Set to empty string for
> default. Not used with sqlite3.
> }
> }
>
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # On Unix systems, a value of None will cause Django to use the same
> # timezone as the operating system.
> # If running in a Windows environment this must be set to the same as your
> # system time zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers and
> # calendars according to the current locale.
> USE_L10N = True
>
> # If you set this to False, Django will not use timezone-aware datetimes.
> USE_TZ = True
>
> # Absolute filesystem path to the directory that will hold user-uploaded
> files.
> # Example: "/home/media/media.lawrence.com/media/"
> MEDIA_ROOT =
> '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/'
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash.
> # Examples: "http://media.lawrence.com/media/";, "http://example.com/media/
> "
> MEDIA_URL = '/media/'
>
> LOCAL_URL = 'http://localhost/'
>
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/home/media/media.lawrence.com/static/"
> STATIC_ROOT = ''
>
> # URL prefix for static files.
> # Example: "http://media.lawrence.com/static/";
> STATIC_URL = '/static/'
>
> # Additional locations of static files
> STATICFILES_DIRS = ('/home/goraya/nanaksar/templates',
> # Put strings here, like "/home/html/static" or "C:/www/django/static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = '%q_rpw9rkr8wi2gjno5ap7k)1j%4rpe(eisczh5zw%dlpa$h6@'
>
> # List of callables that know how to import templates from various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messa

Re: ValueError at / Empty module name

2013-09-04 Thread Mantas Zilinskis
can you post your settings.py


On Wed, Sep 4, 2013 at 12:26 PM, Satinderpal Singh <
satinder.goray...@gmail.com> wrote:

> I face this error after configuring admin.py file in my project:
>
> ValueError at /
>
> Empty module name
>
> Request Method:GET
> Request URL:http://localhost/nanaksar/
> Django Version:1.5.2
> Exception Type:ValueError
> Exception Value:
>
> Empty module name
>
> Exception
> Location:/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py
> in import_module, line 35
> Python Executable:/usr/bin/python
> Python Version:2.7.3
>
> How could i solve this?
>
> --
> Satinderpal Singh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: serve static files

2013-08-26 Thread Mantas Zilinskis
import settings
instead of 'document_root' : STATIC_ROOT, try 'document_root' :
settings.STATIC_ROOT,


On Mon, Aug 26, 2013 at 10:05 AM, Wesley Ni  wrote:

> Forget to say that I use Django 1.5.2
>
> 在 2013年8月26日星期一UTC-4上午10时58分38秒,Wesley Ni写道:
>
>> I hit an issue when trying serve static files.
>>
>> In settings, debug is True, and with the followinig:
>> STATIC_ROOT = os.path.join(freelancer_path,"**staticfiles")
>> STATIC_URL = '/staticfiles/'
>>
>> urls.py:
>> (r'^staticfiles/(?P.*)$'**,'django.contrib.staticfiles.**
>> views.serve',
>> {'document_root' : STATIC_ROOT,'show_indexes' : True}),
>>
>> Problem is, when accessing 
>> http://127.0.0.1:8000/**staticfiles/,
>> I got this:
>> Page not found (404)
>> Request Method: GET
>> Request URL: 
>> http://127.0.0.1:8000/**staticfiles/
>>
>> Why? I thought I would get folder indexes because I set show_indexes to
>> True.
>>
>> And, later, I find that, if I set the url pattern prefix not same to
>> STATIC_URL,
>> say, maybe :
>> (r'^files/(?P.*)$','**django.contrib.staticfiles.**views.serve',
>> {'document_root' : STATIC_ROOT,'show_indexes' : True}),
>> And, then, http://127.0.0.1:8000/files/ is OK to show folder lists.
>>
>> Could anyone help explain and fix?
>>
>> Thanks.
>> Wesley
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: syncdb issue (begginer stuff)

2013-08-26 Thread Mantas Zilinskis
for your environment:
you should definitely look into this
http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/

 if you're using mac also this
http://hackercodex.com/guide/python-virtualenv-on-mac-osx-mountain-lion-10.8/

setup your settings.py
http://www.rdegges.com/the-perfect-django-settings-file/

then work your way through tutorials

one more thing you should start with is writing your tests
http://www.youtube.com/watch?v=WfyoC0h9QKA


On Mon, Aug 26, 2013 at 8:53 AM, Laurent Meunier wrote:

> On 26/08/2013 14:34, Natko Perko wrote:
>
>> Hi out there,
>>
>> I just dove into Django (literally) and had so many issues installing it
>> and knowing where to start from that I don't even know how I made it
>> this far, so i finally started working on a project by mimicing this
>> tutorial 
>> http://showmedo.com/**videotutorials/video?name=**110.
>> Well id
>> didnt last for long since I already got stuck at 3:40 when the gentleman
>> is syncing his db. this is what I get If any1 knows a good video
>> tutorial for dummies please share with me cuz im desperate. Thx for
>> reading..
>>
>
> Hi,
>
> What is the value of DATABASES['default']['ENGINE'] in your settings.py?
>
> I think you have entered only 'sqlite3', but django wants you to enter the
> full path to the module (ie: 'django.db.backends.sqlite3').
>
>
> Best regards,
> --
> Laurent Meunier 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-users+unsubscribe@**googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/django-users
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: html templates and dynamic loading

2013-08-23 Thread Mantas Zilinskis
this might help you

http://stackoverflow.com/questions/1879872/django-update-div-with-ajax

let me know if you need more help


On Fri, Aug 23, 2013 at 10:51 AM, Bastien Amiel  wrote:

>  Le 23/08/2013 17:01, Mantas Zilinskis a écrit :
>
>  can you post all of chat.html
>
>
>
> On Fri, Aug 23, 2013 at 7:04 AM, Bastien Amiel  wrote:
>
>>  Le 23/08/2013 11:26, Huu Da Tran a écrit :
>>
>> On Thursday, August 22, 2013 8:42:04 AM UTC-4, Bastien Amiel wrote:
>>
>>
>>> I need to update the chat when an event come but :
>>>
>>> 1.
>>> If I update my chat sub page, inputs are reset (seems logic since html
>>> is recreated).
>>>
>>
>>  You can always have some field that keep when the chat was started (in
>> the session), and redisplay everything since that time.
>>
>>
>>> Then what would be the good / best method to update only the chat
>>> content ?
>>> (I have 2 ideas but they don't seems very Django'ic)
>>>
>>> 2.
>>> For now, I update the content every XX ms with a periodic request client
>>> side.
>>> Would it be possible / preferable to have a push from server when new
>>> data comes or is there a better way to update this kind of content ?
>>
>>
>>  Trying to hack django to get server push would be hell (look into
>> tornado). If you really need server push, you may need to look into other
>> technologies, like nodejs.
>>
>>  Using the periodic request client-side is what is mostly done.
>>
>>
>>  Hope this helps.
>>
>>  HD.
>>
>>
>> 1.
>> My question was not clear enough,
>> Let's admit i have this template page :
>>
>> *{% for elem in data %}**
>> ****
>> **{{ elem.datetime }}**
>> **{{ elem.name }} :**
>> **{{ elem.text }}**
>> ****
>> **{% endfor %}**
>> **Text : *
>>
>> and this view.py :
>>
>> *def getchat(request):**
>> **template = loader.get_template('chat.html')**
>> **context  = RequestContext(request, { 'data': lines })** # lines is
>> an array with lines
>> **response = {'html' : template.render(context)}**
>> **return HttpResponse(json.dumps(response),
>> mimetype='application/json')*
>>
>> and this javascript :
>>
>> *function getchat()**
>> **{**
>> **$.post('/getchat')**.done(function(data, textStatus, jqXHR) **
>> **{**
>> **$("#chat").html(data["html"])**
>> **})**
>> **}
>>
>> *Then whenever I call getchat() in javascript, the chat is reloaded with
>> all the old lines, this point is ok, but
>>  field is reseted too, which mean that if user was typing, the
>> content is erased.
>> I would say the solution is to create a second function in view *
>> getchatcontent* that will send only the content so I do not
>> update the whole thing. Do you think it is the right way ?
>>
>>
>> 2.
>> lets use periodic request client-side.
>>
>>
>>
>> Thank you for your answer
>>
>>
> There is nothing more in chat.html
> there is a base.html template that contains
>
> ***
> **{% load staticfiles %}**
> 
> **
> **
> 
> 
> 
> 
> **post**
> ***
>
>
> appchat.js
>
>
> *$(document).ready(function()**
> **{**
> **$("#addline").click(function()**
> **{**
> **addline($("#chatname")[0].value, $("#chatinput")[0].value);*
> *
> **$("#chatinput")[0].value = "" **
> **})**
> **setInterval(function() { getchat() }, 1000);**
> **})**
> **
> **function addline(name, text)**
> **{**
> **$.post('/addline', {"name":name, "text":text})**
> **.done(function() ** {** })**
> **}**
> **
> **function getchat()**
> **{**
> **   $.post('/getchat')*
> *
> **.done(function(data, textStatus, jqXHR) **
> **{**
> **   **$("#chat").html(data["html"])**
> **})**
> **}*
>
>
> Now you have everything, does this seems the right way to do what I want
> to achieve with django or is there a better way ?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: html templates and dynamic loading

2013-08-23 Thread Mantas Zilinskis
can you post all of chat.html






On Fri, Aug 23, 2013 at 7:04 AM, Bastien Amiel  wrote:

>  Le 23/08/2013 11:26, Huu Da Tran a écrit :
>
> On Thursday, August 22, 2013 8:42:04 AM UTC-4, Bastien Amiel wrote:
>
>
>> I need to update the chat when an event come but :
>>
>> 1.
>> If I update my chat sub page, inputs are reset (seems logic since html
>> is recreated).
>>
>
>  You can always have some field that keep when the chat was started (in
> the session), and redisplay everything since that time.
>
>
>> Then what would be the good / best method to update only the chat content
>> ?
>> (I have 2 ideas but they don't seems very Django'ic)
>>
>> 2.
>> For now, I update the content every XX ms with a periodic request client
>> side.
>> Would it be possible / preferable to have a push from server when new
>> data comes or is there a better way to update this kind of content ?
>
>
>  Trying to hack django to get server push would be hell (look into
> tornado). If you really need server push, you may need to look into other
> technologies, like nodejs.
>
>  Using the periodic request client-side is what is mostly done.
>
>
>  Hope this helps.
>
>  HD.
>
>
> 1.
> My question was not clear enough,
> Let's admit i have this template page :
>
> *{% for elem in data %}**
> ****
> **{{ elem.datetime }}**
> **{{ elem.name }} :**
> **{{ elem.text }}**
> ****
> **{% endfor %}**
> **Text : *
>
> and this view.py :
>
> *def getchat(request):**
> **template = loader.get_template('chat.html')**
> **context  = RequestContext(request, { 'data': lines })** # lines is
> an array with lines
> **response = {'html' : template.render(context)}**
> **return HttpResponse(json.dumps(response),
> mimetype='application/json')*
>
> and this javascript :
>
> *function getchat()**
> **{**
> **$.post('/getchat')**.done(function(data, textStatus, jqXHR) **
> **{**
> **$("#chat").html(data["html"])**
> **})**
> **}
>
> *Then whenever I call getchat() in javascript, the chat is reloaded with
> all the old lines, this point is ok, but
>  field is reseted too, which mean that if user was typing, the
> content is erased.
> I would say the solution is to create a second function in view *
> getchatcontent* that will send only the content so I do not
> update the whole thing. Do you think it is the right way ?
>
>
> 2.
> lets use periodic request client-side.
>
>
>
> Thank you for your answer
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.