how to show the text line number in the left of the textarea

2012-11-21 Thread jianhui chen
Hi all,
I was wondering how can I show the text line numbers in the left of the
text area.
The result is somehow like this:
1  this is first line.
2  this is second line.
;

The number is in the outside of the box, and it is automatically
displayed when the user change the line.
 By the way, I an new comer in django and learning this
http://www.djangobook.com/en/2.0/index.html now. Is there any source
teaching the interactive response in the web, expecially in text editing?

Jimmy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error: No module named books

2012-11-29 Thread jianhui chen
I am learning django book too. Do you check the output of error.?
Generally, there are hint like ValueError in the output.

On Wednesday, November 28, 2012, Chris Recher wrote:

> Hi all,
>
> I'm working through the Django book and I've run into an error that wasn't
> predicted. I've got a project called mysite. I used "python manage.py
> startapp books" to create an app called books inside of it. I added a few
> models to the models.py file inside books, then tried to use "python
> manage.py validate". I got "Error: No module named books" in return.
> __init__.py is perfectly intact in both the second mysite directory and the
> books directory. I've added mysite.books to INSTALLED_APPS. All the results
> I could find searching for this problem deal with someone that's made a
> spelling mistake somewhere. I've been through my files multiple times, and
> my spelling is pristine. I figure I'm making an obvious, beginner's mistake
> - could anyone help?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/5gaeHt1dGtwJ.
> To post to this group, send email to 
> django-users@googlegroups.com 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com  'django-users%2bunsubscr...@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: strangle url error in django with google app engine

2013-01-08 Thread jianhui chen
The problem is solved. Thanks.


On Mon, Jan 7, 2013 at 10:02 AM, Daniel Roseman wrote:

> On Monday, 7 January 2013 13:54:59 UTC, jianhui chen wrote:
>
>> Hi all.
>>I use djangoappengine http://www.allbuttonspressed.**
>> com/projects/djangoappengine#**zip-packages<http://www.allbuttonspressed.com/projects/djangoappengine#zip-packages>to
>>  manage google app engine.
>>I test a very simple project:
>>url.py:
>>from django.conf.urls.defaults import *
>> from shape_practice.views import introduction
>> handler500 = 'djangotoolbox.errorviews.**server_error'
>>
>> urlpatterns = patterns('',
>> ('^_ah/warmup$', 'djangoappengine.views.warmup'**),
>>  (r'^introduction/$', introduction),
>> )
>>
>> views.py:
>>
>> from django.conf import settings
>> from django.http import HttpResponse
>> from django.utils.importlib import import_module
>> from django.template import loader, Context, RequestContext
>>
>> def introduction(request):
>> t = loader.get_template('**introduction.html')
>> c = Context({})
>> return HttpResponse(t.render(c))
>>
>> but when I type 
>> http://127.0.0.1:8000/**introduction/<http://127.0.0.1:8000/introduction/>. 
>> The browser doesn't show "introduction.html", but another "html", let's
>> say A.html. But A.html can't be found in the urlpatterns. Anywhere else can
>> set .html file?
>> Another strange thing is that: in the url.py file, I can use "from
>> shape_practice.views import introduction", but I can't use
>> shape_practice.views.**introduction which has an "shape_practice
>> undefined error"
>>
>> Thanks.
>>
>>
>>
> You should ask App Engine questions on the App Engine users group.
> Presumably you have something in your app.yaml file which is sending the
> user to static page rather than the Django app.
> If you don't import shape_practice, you can't reference it.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/GoDD8oHllVEJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



show an image in django

2013-01-08 Thread jianhui chen
Hi all,
I want to show an image in project in which the folder DIR looks like this:
images/a.jpg
templates/introduction.html

In introduction.html I use


It can show image correctly when I open the "introduction.html" directly
using firefox, but it shows ""GET /images/gauge_example.jpg HTTP/1.1" 404 "
when I open it in http://127.0.0.1:8000/introduction/, and there is no
image in the webpage.

I used the last method in
http://stackoverflow.com/questions/2148738/cannot-get-images-to-display-in-simple-django-site.
But it doesn't work.

Could anyone give me some suggestions?

jianhui

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't set static file directory.

2013-01-08 Thread jianhui chen
Hi,
   I am not to interrupt your question, actually I have the same problems
as you. It seems that Django comers suffer this problem so much.
   I use Manager Static File as a guide, but still has problem.
   1, Put your static files somewhere that staticfiles will find them
  I set following in the setting.py
  STATIC_URL = '/static/'

 # Additional locations of static files
STATICFILES_DIRS = (
   # 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.
   "E:/code/python/djangoBook/django-testapp-develop/static"  #this is
only used in my local test
  )
   2, Make sure that django.contrib.staticfiles is included in your
INSTALLED_APPS
.
  So I set that:
   INSTALLED_APPS = (
#'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.staticfiles',   #this
'djangotoolbox',
'autoload',
'dbindexer',
'shape_practice',

# djangoappengine should come last, so it can override a few manage.py
commands
'djangoappengine',

)
   TEMPLATE_CONTEXT_PROCESSORS = (
 'django.contrib.auth.context_processors.auth',
   'django.core.context_processors.request',
   'django.core.context_processors.media',
'django.core.context_processors.static',  #this
 )
  3, You’ll probably need to refer to these files in your templates.
   So I did this:

  

  And, so someone pointed out that : using
RequestContext,
so I dit that
  def introduction(request):
t = loader.get_template('introduction.html')
c = RequestContext(request, {})   #this
return HttpResponse(t.render(c))

  The problem is that when I comment out
"E:/code/python/djangoBook/django-testapp-develop/static" in the
STATICFILES_DIRS , it has an error :

"NetworkError: 500  -
http://127.0.0.1:8000/static/images/gauge_example.jpg";. When I didn't
commented out, it works. So I think STATICFILES_DIRS and STATIC_URL
actually works in

my app, the problem is that how to set it to the correct path. In my
case, I want to STATIC_URL can find my "static" folder which is in the
project home directory.

  I was puzzled by this problem many days, right now I have no way but
to use local folder
"E:/code/python/djangoBook/django-testapp-develop/static" to code and
test in my PC.

  Thanks.

Jianhui








On Sat, Jan 5, 2013 at 1:38 PM, Mārtiņš Jakubovičs <
martins.jakubov...@gmail.com> wrote:

> Hello.
>
> I try a lot of things and can't understand, why not working STATIC_ROOT
> and MEDIA_ROOT in settings.py.
>
> I want, that all my media and static folders is in different place that
> python files, so I set media, static and templates to different place.
> Templates TEMPLATE_DIRS works well, bet MEDIA_ROOT and STATIC_ROOT not.
>
> I try setup like this:
>
> /home/domain/www/my_proj/ there is project folder and all apps, and there
> I place my htdocs folder, in which is static, templates and media folders.
>
> When i set in STATIC_ROOT = '/home/domain/www/my_proj/htdocs/static'
>
> In apache error log i got:
>
> File does not exist: /home/domain/www/my_proj/my_proj/static
>
> I don't get, why django don't want to take new setting...
>
> I use django 1.4.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/crL9a25SIWMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: show an image in django

2013-01-09 Thread jianhui chen
My setting.py is:
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *

import os

# Activate django-dbindexer for the default database
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
AUTOLOAD_SITECONF = 'indexes'

SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'

INSTALLED_APPS = (
#'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.staticfiles',
'djangotoolbox',
'autoload',
'dbindexer',
'shape_practice',

# djangoappengine should come last, so it can override a few manage.py
commands
'djangoappengine',

)

MIDDLEWARE_CLASSES = (
# This loads the index definitions, so it has to come first
'autoload.middleware.AutoloadMiddleware',

'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
)

# This test runner captures stdout and associates tracebacks with their
# corresponding output. Helps a lot with print-debugging.
TEST_RUNNER = 'djangotoolbox.test.CapturingTestSuiteRunner'

ADMIN_MEDIA_PREFIX = '/media/admin/'
TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),)

ROOT_URLCONF = 'urls'
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# 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.
"E:/code/python/djangoBook/django-testapp-develop/static",  #this only
used for local debug
)

and I use STATIC_URL in the html

But, it must be something wrong in my setting.py since the project can't
find the image.
Any suggestions? Thanks.



On Tue, Jan 8, 2013 at 4:00 PM, Mario Gudelj  wrote:

> Try removing .. from the path. Also make sure your static path is set
> correctly in settings.py
> On 9 Jan, 2013 1:42 AM, "jianhui chen"  wrote:
>
>> Hi all,
>> I want to show an image in project in which the folder DIR looks like
>> this:
>> images/a.jpg
>> templates/introduction.html
>>
>> In introduction.html I use
>> 
>>
>> It can show image correctly when I open the "introduction.html" directly
>> using firefox, but it shows ""GET /images/gauge_example.jpg HTTP/1.1" 404 "
>> when I open it in http://127.0.0.1:8000/introduction/, and there is no
>> image in the webpage.
>>
>> I used the last method in
>> http://stackoverflow.com/questions/2148738/cannot-get-images-to-display-in-simple-django-site.
>>  But it doesn't work.
>>
>> Could anyone give me some suggestions?
>>
>> jianhui
>>
>>
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: show an image in django

2013-01-12 Thread jianhui chen
Really thanks your help. Finally, I find the problem is not in django
settings, but in google engine settings.
By trying many methods, my problem problem is solved by this way.
add
- url: /static
  static_dir: static  #my static folder is in the root of the project
  expiration: '0'
to app.yaml.

and I run command :

./manage.py collectstatic

before I update file to google app engine, but I don't whether this
command is necessary for the static issue.




On Thu, Jan 10, 2013 at 5:39 PM, @jeffblack360 wrote:

> I think your configuration should allow you to hit your image from your
> browser via the following link:
>
> http://localhost:8000/static/images/gauge_example.jpg
>
> If that works change your replace {{STATIC_URL}} with '/static/'...
>
>  = "390" height = "225" />
>
>
> On Tuesday, January 8, 2013 8:41:55 AM UTC-6, jianhui chen wrote:
>>
>> Hi all,
>> I want to show an image in project in which the folder DIR looks like
>> this:
>> images/a.jpg
>> templates/introduction.html
>>
>> In introduction.html I use
>> 
>>
>> It can show image correctly when I open the "introduction.html" directly
>> using firefox, but it shows ""GET /images/gauge_example.jpg HTTP/1.1" 404 "
>> when I open it in 
>> http://127.0.0.1:8000/**introduction/<http://127.0.0.1:8000/introduction/>,
>> and there is no image in the webpage.
>>
>> I used the last method in http://stackoverflow.com/**
>> questions/2148738/cannot-get-**images-to-display-in-simple-**django-site<http://stackoverflow.com/questions/2148738/cannot-get-images-to-display-in-simple-django-site>.
>>  But it doesn't work.
>>
>> Could anyone give me some suggestions?
>>
>> jianhui
>>
>>
>>
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/AO-VKasUjWcJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



database query error:Subqueries are not supported (yet)

2013-01-14 Thread jianhui chen
Hi all,
There is an Subqueries are not supported (yet) error when I use
"filter" function in databade.
First, I create a database based in models.py:
class ImageItem(models.Model):
name = models.CharField(max_length = 100)
depthOffset = models.FloatField()
depthResize = models.FloatField()
focalLength = models.FloatField()
sensorWidth = models.FloatField()

def __str__(self):
return self.name
def Meta():
ordering = ["name"]

class PixelPosition(models.Model):
xPos = models.FloatField()
yPos = models.FloatField()
depth = models.FloatField()
normalX = models.FloatField()
normalY = models.FloatField()
normalZ = models.FloatField()
imageItem = models.ForeignKey(ImageItem)

   Then I create some data and save.
   Finally I query the database.
1, ps = PixelPosition.objects.all() , no error, I can use ps[0], ps[1]
 but when use 2, pixels = PixelPosition.objects.filter( imageItem =
imageItem), I can't use pixels[0],.. it has an DatabaseError: Subqueries
are not supported (yet).
 I check the type of ps and pixels, both of them is class
'django.db.models.query.QuerySet'.I don't understand why the result of
PixelPosition.objects.filter() has this error.
Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django hosting companies

2013-01-30 Thread jianhui chen
I use google app engine.


On Tue, Jan 29, 2013 at 8:17 AM, francislutalo wrote:

> Anyone with an idea of which are the best companies to host my django
> applications?
>
>
>
> Thank you,
> Regards
> francislutalo
>
> --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.