Re: Django user model. 1 admin account, 1 customer account with the same email and different password

2020-04-13 Thread Bill Freeman
Many e-mail systems allow you to add a suffix to the username portion of the address, separated by something like a "-", or, last time I checked for gmail, by a "+", and it will still be delivered to the same mailbox. For example, I expect mail sent to ks.kennysoh+ad...@gmail.com will still

Re: filter objects dynamically on page render based on button click (beginner question)

2020-02-13 Thread Bill Freeman
Note that Vue is one option among many and could either be overkill or not helpful enough for your specific use case OR BOTH. It's just modern, and may be useful for projects beyond this one. It doesn't hurt to be familiar with the grand daddy of them all: jQuery (though many sneer at it today).

Re: filter objects dynamically on page render based on button click (beginner question)

2020-02-12 Thread Bill Freeman
What happens in the browser stays in the browser, unless you do something about it. Forgive me if I'm being too basic below: There are three approaches to click and see a filtering change, with trade offs in performance, complexity, and the impact if the user's browser is on a humble box. 1.

Re: is there a WYSIWYG for Django

2020-02-08 Thread Bill Freeman
, menu > and a few pages) then hand that over to the owners to maintain using > TinyMCE?? What about mobile etc...? > > Johnf > > On 2/8/20 8:36 AM, Bill Freeman wrote: > > I have used Django Fiber: http://ridethepony.org/ > And several other CMS. I mostly used Ti

Re: is there a WYSIWYG for Django

2020-02-08 Thread Bill Freeman
I have used Django Fiber: http://ridethepony.org/ And several other CMS. I mostly used TinyMCE. The world may have moved on. On Sat, Feb 8, 2020 at 11:02 AM johnf wrote: > Thanks that is a start. I would also like something that will help with > design of the pages/views. > > Johnf > > On

Re: Getting the first item in a dict

2020-01-27 Thread Bill Freeman
Note that these give the only value. This won't work if you have more than one value in the dict, since you won't know which you will get. Where d is the dict: list(d.values())[0] or for i in d.values(): # use i here print(i) or d[list(d)[0]] I'm sure that there

Re: Which Cloud Service Provider should be chosen to host Django Application

2019-12-03 Thread Bill Freeman
's a bit overwhelming for a beginner like > me. Guess I'll do a test run with Heroku's free account to get a feel of > the process. > > Anyway, thanks again for all the efforts man! > > Cheers! > > Deb > > On Mon, Dec 2, 2019 at 8:41 PM Bill Freeman wrote: > >&

Re: Which Cloud Service Provider should be chosen to host Django Application

2019-12-02 Thread Bill Freeman
Deployment for a production environment is never without complications. And that is affected by how much you choose to configure yourself. I can't speak for Heroku, Digital Ocean, or Python Anywhere, because I haven't used them. Perhaps some of their users will comment. Even with virtual

Re: Which Cloud Service Provider should be chosen to host Django Application

2019-11-30 Thread Bill Freeman
SQLite is fine for development, but, unless things have changed, it is single threaded, and unsuitable for a production environment. Most folks seem to go for MySQL, though the fork MariaDB is usually preferred no that Oracle owns MySQL. I prefer PostgreSQL (or just Postgres) because I think

Re: text data types

2019-10-08 Thread Bill Freeman
TextField() On Tue, Oct 8, 2019 at 12:42 PM Mohsen Pahlevanzadeh < m.pahlevanza...@gmail.com> wrote: > I need to create text data type in model.py, CharField() has max_len as > mandatory, What do you recommend instead of CharField() ? > > -- > You received this message because you are subscribed

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE

2019-07-15 Thread Bill Freeman
Once there was no such thing as a cookie that expired at browser close. Note that such must be implemented by the user agent (browser), since that's the only thing that knows if it has been closed. (And, in fact, if you want it to be closed if the browser crashes, or if it is hard killed by the

Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread Bill Freeman
Like many tools, it will take longer to learn to use it well than it takes to code a small project, though it will start to help along the way. As an emacs user, I already had what I needed and more, so it was hard to justify the extra effort, but I was working where everyone else used it, and it

Re: Create project in windows, but run it in Ubuntu

2019-03-22 Thread Bill Freeman
Using git does not require github. You can use any accessible machine to serve a git repository, to which you can push, and from which you can pull, using, for example, git+ssh (you could also use an ssh tunnel, but git supports ssh transport directly). Do set up ssh to require keys and not

Re: rsync vs git for Django development? + Project directory location?

2019-03-15 Thread Bill Freeman
I'm sure that you'll get many opinions, but: I've had success with git, presuming that filesystem space is not very tight on the remote server. You arrange your deployment scripts to run on the remote (there are several tools to help with that, or for small scale operations, ssh in and run them

Re: order_by function gets error if the field name or json key, has a dash.

2019-01-14 Thread Bill Freeman
At least on 2.7, python has no trouble with this: d={'x-y': 4} >>> import json >>> json.dumps(d) '{"x-y": 4}' >>> So that leave's Django's parsing of the order_by string, or just possibly the database connector. It probably won't work, but you could try:

Re: How to hide the password of postgresql in settings.py

2018-11-30 Thread Bill Freeman
You should be keeping settings.py secure. There's other stuff that shouldn't be public. That's why the django project directories are not included in the pages that the front end web server is allowed to serve, among other things. Security is tough. There's no magic answer. On Fri, Nov 30,

Re:

2018-08-11 Thread Bill Freeman
A context contains the variables that you want your template to be able to access. It is common to want to access stuff from the request. You could copy those things that you need into the dict that you pass to the Context constructor or define an element of the dict to hold the Request object

Re: Clarification on Foreign Keys requested

2018-03-06 Thread Bill Freeman
pk uuids are made > automatically. Thanks > > *“None of you has faith until he loves for his brother or his neighbor > what he loves for himself.”* > > On Mon, Mar 5, 2018 at 2:16 PM, Bill Freeman <ke1g...@gmail.com> wrote: > >> Are you specifying the to_field a

Re: Clarification on Foreign Keys requested

2018-03-05 Thread Bill Freeman
Are you specifying the to_field argument, or are you letting it default? And is the pk of the other model made by Django by default, or are you explicitly specifying a foreign key constraint on some field of your own. Things might be better in 2.0, but I've had my troubles with pk that isn't an

Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-27 Thread Bill Freeman
I don't do development in Windows, so take this with a grain of salt, but under the directory in which you created your virtualenv, there should be a directory called "bin". In that there will be a couple of files whose names begin with "activate". There may be one with an obvious Windows

Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-27 Thread Bill Freeman
You don't say what OS/platform you are using, and I don't know if what I say below applies to Windows, but should be valid elsewhere. Note, too, that I presume that you are using a command line (e.g.; xterm/bash). I also presume that you have managed to install virtualenv on your system. If

Re: nginx+uwsgi, cache somewhere but I don't know where

2016-08-16 Thread Bill Freeman
Cached in browser, maybe? On Tue, Aug 16, 2016 at 11:43 AM, Avraham Serour wrote: > How do you know the query is cached? > > On Aug 16, 2016 6:33 PM, "술욱" wrote: > >> I forgot to say I reloaded (and restarted) nginx and uwsgi, but the query >> is still

Re: Test fails when run in whole test suite - but not stand-alone?

2016-06-25 Thread Bill Freeman
I have no immediate clue. I know that, using nosetest, I can add -s and -v to the command line, making it possible to drive pdb from the test, using: import pdb;pdb.set_trace() inserted in the code to get into pdb at the relevant point(s). Evan if you're not running under nosetest, there

Re: Stuck on tutorial your first Django app part 2

2016-06-09 Thread Bill Freeman
What is the definition of your __str__() method? On Thu, Jun 9, 2016 at 4:11 PM, Neil Hunt wrote: > Hello, > > I'm enjoying the tutorial and now I'm stuck on the second page (writing > your first Django app part 2), shortly after this paragraph. > > 'It’s important to add

Re: Why don't I see my category ForeignKey field in related Model

2016-05-13 Thread Bill Freeman
If you use a ManyToManyField, Django creates the join table for you. In the rare case that you need to store additional data on the join table, you can create your own and use ManyToManyField.through On Fri, May 13, 2016 at 5:00 AM, Bruce Whealton < futurewavewebdevelopm...@gmail.com> wrote: >

Re: Why don't I see my category ForeignKey field in related Model

2016-05-11 Thread Bill Freeman
This is a many to many relation. One contact can have multiple relations, according to your text, but clearly, more than one contact can be family, etc. And if, instead, each contact can have only one relation, then the ForeignKey goes in the Resource (contact) model, not the Relationship

Re: How displaying text as code?

2016-03-25 Thread Bill Freeman
Consider the tag. On Fri, Mar 25, 2016 at 4:47 PM, Seti Volkylany wrote: > > I had text in database on TextField. I am using this field in my template > applying tag *linebreaksbr* but text displaying simple plain. > > In console I have next result: > > Out[60]: 'class

Re: Django Newbie - Tutorial Recommendations?

2016-03-19 Thread Bill Freeman
As far as learning python goes, especially if you already program in another language, the tutorials at docs.python.org are quite good. If you are using python 2 instead of python 3, note the "Docs for other versions" section in the top of the left hand column. If you don't already program in

Re: partial database restoration

2016-03-10 Thread Bill Freeman
important. You may have to clean up old DB content for that user before the restore. So I might write the restore in python. But then, I've never written DB PL, so I could be missing a bet. On Thu, Mar 10, 2016 at 12:15 AM, Mike Dewhirst <mi...@dewhirst.com.au> wrote: > On 10/03/2016 11:15

Re: partial database restoration

2016-03-09 Thread Bill Freeman
The only problem I can think of with a DB script is that it may have to be recoded at unpleasant times, such as when you run a migration to take a new version with a security fix. If you are going to do it in Django, it would be by saving stuff out to a fixture, maybe with a custom management

Re: var1 = var2 = var3

2016-02-18 Thread Bill Freeman
The interesting thing is how chained assignment is implemented. In C, the following is an expression, and has a value: a = b This leads to the compiler not being helpful for the famous =/== typo in this like: if (a = b) { ... } In python the only expression in: a = b = c only has

Re: Trying to upgrade Django using pip on CentOS results in segmentation fault

2016-02-17 Thread Bill Freeman
Or clone into a new virtualenv (you are using virtualenv, aren't you, and you are using requires.txt and pip, and your code is in revision control, right?), then change the Apache configuration to use the new VE and restart. On Wed, Feb 17, 2016 at 7:00 AM, Mike Dewhirst

Re: Kind'a TL, but please DR - Need your thoughts

2016-02-01 Thread Bill Freeman
I suggest that you use Celery. If people are making HTTP requests of you, that is reason enough to choose Django. But do not wait for long calculations to complete before returning an HTTP result. Instead redirect to a page containing simple JavaScript that will poll for a result. PostgreSQL

Re: Debugging Django with Debug set to False

2016-01-04 Thread Bill Freeman
You don't say what your front end is. There are ways to use pdb with apache, look for advise on the modwsgi site. But if you are in production, rather than just bringing up the instance that will be production, you may not want to interrupt. Be sure that you can't reproduce the problem in the

Re: Scanning for Wifi

2015-12-28 Thread Bill Freeman
Yes, though there probably isn't a slick app for the PC to do it. You would have a web server running on the Pi, maybe Django, that displays the available wireless networks. You would want a button to re-scan. This works by trigering a shell command to run iwlist (or whatever the current tool

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Bill Freeman
Did you see some documentation that said that the test framework will clear the database? I'm not sure that it's reasonable to ask a test framework to do that, given the number of possible databases and interface layers, though it is conceivable that django's variation on test could take care of

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Bill Freeman
Make test b clean up after itself, by deleting the test object. On Wed, Dec 2, 2015 at 9:28 AM, Tim Graham wrote: > It will be easier to help if you can provide a sample project that > reproduces the error. > > On Wednesday, December 2, 2015 at 3:01:31 AM UTC-5, Siddhi

Re: custom setting provided by myapp

2015-09-23 Thread Bill Freeman
l most of time. > > 2015-09-23 12:10 GMT-06:00 Bill Freeman <ke1g...@gmail.com>: > >> I would be upset to find an app that I installed fiddling with my project >> settings. >> >> On Wed, Sep 23, 2015 at 12:53 PM, Luis Zárate <luisz...@gmail.com> wrot

Re: Django admin suitable for external users?

2015-09-23 Thread Bill Freeman
How technical are your users? What are your security constraints? How much work can you do to make it "pretty"? (Believe me, someone will ask.) Are there fields that you want to administer internally but don't want to expose to the users? Will your users object if you decide to move to a newer

Re: custom setting provided by myapp

2015-09-23 Thread Bill Freeman
I would be upset to find an app that I installed fiddling with my project settings. On Wed, Sep 23, 2015 at 12:53 PM, Luis Zárate wrote: > Hi, > > l have an app than need other apps to run well, I create a requirements > file and setup file and insert the required apps in my

Re: Entry.objects.filter(pub_date__month=7) doesn't work with Django 1.8

2015-09-22 Thread Bill Freeman
What does the following say? Entry.objects.filter(pub_date__year=2015)[0].pub_date.month If it says 7, then its time to delve into the generated SQL for the month query. On Tue, Sep 22, 2015 at 10:52 AM, lxm wrote: > I create a class named Entry,like this: > >> class

Re: Why should I care to use YAML with Django?

2015-08-17 Thread Bill Freeman
One interesting feature of YAML is the ability to have custom operators. For example, with YAML used as a fixture, you might have an operator that turns a hex string into a MongoDB ObjectId on read, or a date string into a datetime object, meaning that you don't have to post process the data read.

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Bill Freeman
If you have your heart set on a circuit breaker pattern (patterns are overrated, see http://www.paulgraham.com/icad.html), consider implementing it in the client. If you need a long poll solution, note that you can serve some urls from uwsgi/Django and others from tornado or twisted. If you are

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Bill Freeman
In Django, requests should not wait, since the threads are relatively heavyweight in python, and need to be a limited resource. The alternative is a large number of processes, which is also expensive. So you must design a scheme in which the client polls for a result, meaning that you cannot

Re: What Did I Do Right? (url and domain name change)

2015-08-06 Thread Bill Freeman
Look at "Sites" in the admin. On Thu, Aug 6, 2015 at 5:03 PM, Malik Rumi wrote: > I have 1 model from my django project up and running on django. Before > adding more models and content, I wanted to use my actual domain name, > instead of whatever.herokuapp.com. So after

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
t; something in Django beyond merely connecting to the server and maybe > configuring the admin? I am getting tired of just connecting to the server > and then "calling it a day" if you know what I mean. > > > > On Wed, Jul 22, 2015 at 1:20 PM, Bill Freeman <ke1g..

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
quot;. I got it gpoing. I had just forgotten to do > this command : "pip install django" in the "burrus" virtual environment > inst ance! I still have the shakiest knowledge of django in general so > little mistakes like this I am gonna have a little while longer.* &

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
I presume that you have actually checked for a django-admin.py file in the Scripts directory? On Wed, Jul 22, 2015 at 12:58 PM, Steve Burrus wrote: > > *well I haVE tried both this "python .\Scripts\django-admin.py > startproject me" and Bill's suggestion opf "python

Re: Find Django Source Files

2015-07-22 Thread Bill Freeman
Note that this is a limitation of you shell. (I presume that you are using cmd.exe.) On linux in bash the tutorial version works fine. You are likely to find a number of things that are different from the experience of the document writers if you are using Windows. On Wed, Jul 22, 2015 at

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
Try no space between ".\Scripts\" and "django-admin.py" You could also try forward slashes on the django-admin.py line (I think that you need the back slashes on the activate line). And I don't think that you need the ".\" on the django-admin.py line. And, if that activate is activating a

Re: Match multiple URLs to the same pattern

2015-07-14 Thread Bill Freeman
You will want a routing view, or a fallback cascade. In either case, make that urlpattern r'^([\w-]+)$'. You don't need to escape the - because it's the last char in the class. You don want to restrict the urls to those in which the entire url matches (^ and $), and the parentheses capture the

Re: How to save base64 string in Python django

2015-07-14 Thread Bill Freeman
You don't show where the 'Image' object comes from (in Image.open), so I can't be specific, but here are some generalities: "Incorrect padding" is probably a message from the base 64 decoder. Capture your request.POST[photo] to play with separately. If you are doing this under the development

Re: Can't Start Project.

2015-07-02 Thread Bill Freeman
n't > figured out yet how to do that I am afraid. > > > > On Wed, Jul 1, 2015 at 5:51 PM, Bill Freeman <ke1g...@gmail.com> wrote: > >> As long as you're happy with the default file name. >> >> On Wed, Jul 1, 2015 at 6:06 PM, Gergely Polonkai <gerg...@pol

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
As long as you're happy with the default file name. On Wed, Jul 1, 2015 at 6:06 PM, Gergely Polonkai <gerg...@polonkai.eu> wrote: > No, Django does that for you. You only have to worry about DB settings if > you want something else like MySQL or Postgres. > On 1 Jul 2015 23:40

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
d was [finally] > able to connect to the django server. I assume trhat I can easily do the > "python manage.py syncdb" to connect to the sqllite3 server? > > > On Wed, Jul 1, 2015 at 3:58 PM, Bill Freeman <ke1g...@gmail.com> wrote: > >> It sounds like dja

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
t; line 8, in from django.core.management import > execute_from_command_line ImportError: No module named > django.core.management" I r enamed my newly created project to "src". > > > On Wed, Jul 1, 2015 at 3:14 PM, Bill Freeman <ke1g...@gmail.com> wrote: > >> cd to the di

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
cd to the directory containing manage.py (the project directory), then: python manage.py runserver On Wed, Jul 1, 2015 at 2:04 PM, Steve Burrus wrote: > well I was able to create a new project earlier however I am now having > trouble with starting the django ser

Re: ValueError: No JSON object could be decoded

2015-06-22 Thread Bill Freeman
You probably don't want request.body. You are probably POSTing the JSON using a form, which means that it shows up as something like request.POST['data'], where you should replace 'data' with the name of the form element (textarea?) where you are putting the JSON. Posting with a form wraps

Re: comment and uncomments in django html template

2015-06-19 Thread Bill Freeman
If your JavaScript comes from a django template, yes, the comment tag will work. If, instead, you want the lines delivered to the browser, but commented out as far as JavaScript is concerned, use /* to start the comment and */ to end it -- multiple lines are allowed. On Fri, Jun 19, 2015 at

Re: Ready to throw the keyboard using Django 1.7 on Windows 7

2015-06-19 Thread Bill Freeman
Is this under manage.py or behind a wsgi front end like Apache/mod_wsgi or ngnx? If under manage.py, you need to cd to the directory containing manage.py first. (There are ways around this if absolutely necessary.) If behind a wsgi front end, there are other means for insuring that this

Re: Reuse jquery

2015-06-02 Thread Bill Freeman
Are you saying that you can't access it as django.jQuery ? On Tue, Jun 2, 2015 at 4:22 AM, guettli wrote: > I guess I am missing something. > > Is there no way to load jquery only once per page? > > Use case: I have two widgets which need jquery. I want to use > these widgets

Re: Testing a new app

2015-05-28 Thread Bill Freeman
If the "new" app doesn't need services from the larger app in order t work, but rather the other way around, why not leave it separate, and later, just make it an install requirement for the larger app? On Thu, May 28, 2015 at 5:54 AM, Klaas Feenstra wrote: > Using GIT would

Re: Embeding HSQLDB in a standalone App

2015-05-20 Thread Bill Freeman
Can you access the js files via their static urls? Does your html load the js (e.g. in script tags)? Can you make it work with html accessed via file:/// type urls (keeping django out of the mix)? On Tue, May 19, 2015 at 10:06 PM, Robert librado wrote: > Anybody

Re: clear database (drop all tables)

2015-04-29 Thread Bill Freeman
With suitable privileges, you can drop the database and recreate it. In at least some databases the user privilege grants are not lost with the database and don't have to be recreated when the database is. And, if you're using SQLite, just remove the file. On Wed, Apr 29, 2015 at 6:10 AM, lars

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
be the last one overall. Any of your other patters, for you Django views, for example, have already not matched by the time this one gets tried. On Wed, Apr 22, 2015 at 11:17 AM, Bill Freeman <ke1g...@gmail.com> wrote: > By the way, you can test whether the regular expression matches without

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
/css/style.css') # Does not match >>> re.match(r'^(?P(?:js|css|img)/.*)$', 'apps/another.html')# Does not match >>> re.match(r'^(?P(?:apps|js|css|img)/.*)$', 'apps/another.html') <_sre.SRE_Match object at 0x7fb34977ddc8> >>> _.groups() ('apps/another.html',) >

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
Are css and js subdirectries of apps as implied by the (as received) indentation of your message? Note that your "other" url pattern has js, css, and img, but no apps. On Wed, Apr 22, 2015 at 9:28 AM, LiteWait wrote: > Well, this doesn't work completely. > > Consider the

Re: Difficulty in passing positional arguments in url !!!

2015-04-21 Thread Bill Freeman
parameter ( > (\w+)/) will be passed to my appropriate view !! > > On Wed, Apr 22, 2015 at 1:15 AM, Bill Freeman <ke1g...@gmail.com> wrote: > >> I think that it is the question mark in your url pattern that is causing >> the problem. In a real url, questio

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-21 Thread Bill Freeman
That may work for most static things. The question is whether the static server is happy with an empty path, assuming that you're trying to serve "/" this way. If not, you might add a separate (earlier) pattern of r'^$' that specifies a path in the extra parameters dictionary (where you have

Re: Runserver/DEBUG only, serve / from static directory

2015-04-21 Thread Bill Freeman
If I understand your needs, try r'^$', which will catch only the top of the site. (You might want r'^(?:index.html)?$' in case some old browser you deal with has that fiddle, but the browser really should try what you typed first.) On Tue, Apr 21, 2015 at 3:02 PM, LiteWait

Re: Difficulty in passing positional arguments in url !!!

2015-04-21 Thread Bill Freeman
I think that it is the question mark in your url pattern that is causing the problem. In a real url, question mark separates the path from the query parameters. Parentheses in url patterns are for capturing parts of the path, and are not associated with query parameters. Just leave out the ?

Re: How can I work with pyserial and django form?

2015-04-07 Thread Bill Freeman
It sounds as though you have a set of sensors (scales, license readers, barcode readers) which provide their readings over asynchronous serial (that's what pyserial can connect with). You have some computer or set of computers that collectively provide a sufficient number of serial ports to

Re: Django TCP socket communication

2015-03-27 Thread Bill Freeman
There is a sense in which what you are describing, for the Django side, is what a webserver, including one involving Django, ordinarily does. The only requirement the web server makes (and some can get around it with work) is that the data sent over the socket, at least from the client

Re: Load Template without rendering/parsing

2015-03-16 Thread Bill Freeman
But that's what the template loader does. It loads *DJANGO* templates. If it does the loading, the template will receive Django processing. I see two choices: 1. Quote everything in the template that looks like a Django template special syntax so that the rendering process instead just renders

Re: Django 1.6's lifespan for security updates?

2015-03-11 Thread Bill Freeman
You should really decouple yourself from the distro's choices, saving headaches in the future. Let me expand on Avraham's suggestion. There is little difficulty in having more than one version of python on a box. The main caution here is that the distrio's use of python might depend on that

Re: Using the eval() command

2015-03-10 Thread Bill Freeman
eval() operates on an expression, not a statement. Assignment makes it a statement. Why wouldn't you just say: innerDict['+newinnrkey+'] = newinnrval On Tue, Mar 10, 2015 at 5:25 PM, Henry Versemann wrote: > I have a new dictionary that I want to build, using data

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-10 Thread Bill Freeman
OK. but I need more code context. The if statement that does the modification is clearly python, so at that point rspnsdata must be a python dictionary, not a JSON string. Yet, if I understand you correctly, it is JSON to begin with (and you are using json.loads() to turn it into python data so

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Bill Freeman
If it's not the basics, then you haven't provided enough information to allow someone to spot the problem. If you post the code that is performing the modification, someone may be able to spot the issue. On Mon, Mar 9, 2015 at 1:50 PM, Henry Versemann wrote: > Yes Id did

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Bill Freeman
Did you remember to set the content type of your response to application/json? On Mon, Mar 9, 2015 at 1:18 PM, Henry Versemann wrote: > First to be clear up front let me say that I'm using Django1.7, Python > 2.7.8, and the requests (Requests: HTTP for Humans >

Re: django doesnt wait for my time.sleep

2015-03-04 Thread Bill Freeman
Sleeping in a web server, which potentially has many users, is considered bad form, even if it works. A better place for such time outs is in JavaScript in the browser. Some designs use a view that the JavaScript (or user) can poll to determine when the resource is available. On Wed, Mar 4,

Re: Issue in Django count string in a template

2015-02-12 Thread Bill Freeman
Show me your view. On Thu, Feb 12, 2015 at 2:49 PM, Ronaldo Bahia wrote: > Thanks for answering. > > Can you provide some example? > > Cheers > > Em quinta-feira, 12 de fevereiro de 2015 17:00:28 UTC-2, ke1g escreveu: >> >> I presume that your messages are model instances.

Re: Issue in Django count string in a template

2015-02-12 Thread Bill Freeman
I presume that your messages are model instances. If so, create a queryset for the unread messages in your view, and pass that, or the result of applying .count() to it, as a template context variable, say "unread_message_count". On Thu, Feb 12, 2015 at 1:06 PM, Ronaldo Bahia

Re: export DJANGO_SETTINGS_MODULE

2015-01-21 Thread Bill Freeman
It looks like you are typing "*django-admin.py startproject WebSite*" at the python prompt, which is incorrect. You type it at the shell. If you get command not found, then instead type "python full/path/to/django-admin.py startproject WebSite". And in any case, the current directory must be

Re: Database field for Image Upload

2014-10-29 Thread Bill Freeman
Note that if these images will be displayed on the site it is best done by your front end (Apache, ngnx, etc.) since the HTML to show them treats them as a separate request, and serving static files is your front end's forte. The front end knows how to do this with files, but probably not with

Re: How can I make the field layout of a model form dynamic?

2014-10-22 Thread Bill Freeman
Perhaps the most djangoish way would be to create two model forms, with different fields excluded, and choose which to render in the template. Or you could render CSS style information to hide one or the other. Or you could use JavaScript to hide one or the other based on something else that you

Re: What is *the* django 1.7 IDE which is opensource & multiplattform

2014-09-24 Thread Bill Freeman
I just use emacs. One of the original open source tools. Template syntax support requires a plugin, and I might try one some day, but html mode has been satisfying so far. Also, since I know how to type, running my own management commands in an emacs shell window works for me. This sort of

Re: I have configured SysLogHandler for my django app but nothing is going into the log file

2014-09-23 Thread Bill Freeman
This is from my logging config file from a non-django project, but the principals should be similar. Before you look too hard here, are you sure that rsyslog.d (or equivalent) is running on the box (at which you have targeted the logger? Is the facility on which you are logging configured (In my

Re: websockets in django

2014-08-25 Thread Bill Freeman
+1 on tornado. I may be behind the times, but I don't think that the Django architecture lends itself to persistent connections. Also, Django is intended to run behind another server, such as Apachi, nginx, etc., and that server, too, would need to be amenable to persistent connections. This

Re: nginx and django without virtualenv

2014-08-06 Thread Bill Freeman
Right. I thought of that later. But virtualenv or not is still just a different sys.path, and you still have to have your stuff installed in the correct python. On Wed, Aug 6, 2014 at 1:53 PM, Bill Freeman <ke1g...@gmail.com> wrote: > Though if he's moving to nginx, thus not mod_wsgi

Re: nginx and django without virtualenv

2014-08-06 Thread Bill Freeman
Though if he's moving to nginx, thus not mod_wsgi, I guess it doesn't matter what mod_wsgi is linked against. On Wed, Aug 6, 2014 at 1:49 PM, Collin Anderson wrote: > Actually, that's a good point. I always use the same python version that's > linked with mod_wsgi. I

Re: nginx and django without virtualenv

2014-08-06 Thread Bill Freeman
Performance *should* be identical. All that virtualenv does (from the point of view of the executing python program) is to change how sys.prefix and sys.exec_prefix are set, and thus, how sys.path is calculated. But with a vanilla sys.path, you need to be sure that django, your other

Re: How to call a function when a project starts.

2014-07-31 Thread Bill Freeman
It runs twice because runserver uses two processes: the real server, and; the monitoring process that restarts the other when you change a source file. You could fool around with undocumented internals to figure out which a given import is running in. Or you could use a modifies runserver

Re: Find link in a "dynamic" page

2014-07-19 Thread Bill Freeman
Are you keeping the cookies and returning them is subsequent requests? (Particularly the session cookie, but all will work as well - if this is the problem.) On Thu, Jul 17, 2014 at 1:50 PM, Carlos Perche wrote: > Hello guys, could someone help me with this ... >

Re: Did Ubuntu 14.04 or Linux Mint 17 break your Django project files?

2014-07-16 Thread Bill Freeman
I make it a point to never use a python build that comes from a .deb for any real development. The OS vender may require certain python features for its management scripts, but I don't like my development tools changing out from under me. Build yourself a python from source, putting it some

Re: settings.configure() does not allow me to access custom variables in settings.py

2014-07-07 Thread Bill Freeman
I don't know how fussy about not using stuff from django you are, but the following works for me: $ DJANGO_SETTINGS_MODULE=foo.ct python >>> from django.conf import settings >>> settings.INSTALLED_APPS Obviously, you replace "foo" with the name of your project. This prints my installed

Re: How to install psycopg2 using Pip?

2014-06-16 Thread Bill Freeman
One possibility is that you have it, but it is in a directory that is not on you path. Try: find / -name pg_config 2> /dev/null If this finds the executable, you can add the directory your current invocation of the shell (It will be gone when you log out and back in) to do the pip install.

Is anyone using MariaDB for Django on CentOS

2014-06-12 Thread Bill Freeman
I'm having trouble installing mysql-python because the MariaDB installed libmysqlclient_r.a is "incompatible" (missing dependencies according to http://data-matters.blogspot.com/2013/08/install-mysql-python-with-mariadb.html). There is rumored to be a fixed package for deb based systems, but

Re: django installation

2014-06-11 Thread Bill Freeman
Still, the OP's command should have worked. The most likely problem is that Django was installed to a different python than the one he gets when he types "python" at the shell. He does not say how he installed Django, so it is hard to advise. On Wed, Jun 11, 2014 at 6:23 AM, Daniel Roseman

Re: PyDev 3.4.1 & Django 1.7: undefined variable from Import

2014-05-12 Thread Bill Freeman
, May 12, 2014 at 9:04 AM, Bill Freeman <ke1g...@gmail.com> wrote: > But the code works, right? > > This is a PyDev issue, not a Django issue. > > (If you can only use code that your IDE understands, that leaves out a lot > of interesting programs.) > > > On Mon, May

Re: What does "+=" mean, or do?

2014-05-12 Thread Bill Freeman
a += b is nominally the same as a = a + b To make class instances support this behavior the class can implement the __iadd__ special method. See docs.python.org and read about special methods. This notation originated, so far as I know, in the C language. It at least goes back that far. On

  1   2   3   4   5   6   7   8   9   >