Re: ComboBox

2022-06-05 Thread Phil Parkin
Thanks for the responses. 
*rgam* - I appreciate what you are saying. I think it is roughly what I am 
doing now, but it is a bit clumsy in that  the user (of a financial 
application) will typically have a list of regular  customers to select 
from, and also may have other customers that are one-off, or infrequent 
which they will not want to clutter their options list with but still need 
to record against a transaction.
*Ryan *- thanks, the datalist looks like it might be right option. I will 
look at custom widgets.

All the best - Phil
On Wednesday, 1 June 2022 at 09:13:11 UTC+1 rgam...@gammascience.co.uk 
wrote:

> Hi
>
> If any arbitrary text is allowable, then at the model level I'd just use a 
> CharField. I wouldn't add a choices= argument to the field unless is the 
> value is strictly constrained to those choice as other test would then fail 
> validation.
>
> At the Form level, I'm not sure. I'd probably work just mirror what the 
> frontend needed.
>
> Does that help ?
>
> On Tue, 2022-05-31 at 09:52 -0700, Phil Parkin wrote:
>
> Hi all
>
> I am converting a desktop application to Django web application. The 
> desktop app uses comboboxes (editable dropdown/select). Is their any 
> elegant way of applying the same functionality in Django? Stack Overflow 
> etc. all seem to be about dropdown select lists only.
>
> I can see ways of doing this with a Choicefield plus a separate Charfield, 
> but is there a better way?
>
> Thanks -Phil 
>
> -- 
> 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...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/1b7836ae-e52e-4e35-aefc-739ce6f586d0n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/1b7836ae-e52e-4e35-aefc-739ce6f586d0n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cdd3deef-3f9b-401b-b7df-864848d09086n%40googlegroups.com.


ComboBox

2022-05-31 Thread Phil Parkin
Hi all

I am converting a desktop application to Django web application. The 
desktop app uses comboboxes (editable dropdown/select). Is their any 
elegant way of applying the same functionality in Django? Stack Overflow 
etc. all seem to be about dropdown select lists only.

I can see ways of doing this with a Choicefield plus a separate Charfield, 
but is there a better way?

Thanks -Phil 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b7836ae-e52e-4e35-aefc-739ce6f586d0n%40googlegroups.com.


best way to display static python monitoring thread output

2020-03-23 Thread Phil Kauffman
Hello,

Wondering if I can bounce my problem off some folks for an idea of how to 
solve it.

My colleague and I are trying to pull in a python Rest API library for a 
piece of software. Rather than have end users run scripts we wanted to make 
a basic gui for them. I've got the basic tests working fine but one area 
we're lacking is the monitoring status.

I'm struggling conceptually with how to handle a static monitoring thread 
that queries an API server that's running processes that I need to know the 
status of. 

The API server doesn't support stateful sessions for streaming data so I 
have a python monitoring thread that periodically re-queries the API 
gateway for test status. Works great from a CLI, but no sure how to handle 
it in Django. 

If anyone can provide some insight into a viable method for this please let 
me know. 

Thanks

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e2cfd736-4238-4b1e-a413-046185b3d6c5%40googlegroups.com.


Re: understanding urls, forms, and HTTP ERROR 405

2020-02-20 Thread Phil Kauffman
So something like this?
def site(request, site_id):
site = get_object_or_404(Site.name, pk=site_id)

def sitesubmit(request):
#site=get_object_or_404(Site, pk=site_id)
form = SelectSite()
if request.method == 'POST':
form = SelectSite(request.POST)
if form.is_valid():
instance = form.save(commit=False)
instance.name = site.site_id
instance.save()
else:
form = SelectSite()
return render(request, 'app/home.html', {'form': form})

I'm just learning this stuff. If you can think of any posts or examples 
please let me know.

On Thursday, February 20, 2020 at 1:16:07 PM UTC-5, OnlineJudge95 wrote:

>
>
> On Thu, Feb 20, 2020 at 11:38 PM Phil Kauffman  > wrote:
>
>> Hello,
>>
>> Newbie in need of a little shove. It seems I need to review the purpose 
>> of the urls.py file. At present I am getting an HTTP Error 405 with the 
>> following:
>>
> HTTP 405 error code states the the HTTP method is not allowed on the 
> endpoint (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405) 
>
>>
>> urls.py:
>> path('', views.show_site, name = 'home'),
>> path('site-view', views.List.as_view(), name='site-view')
>>
>> views.py
>> class List(ListView):
>> def get_queryset(self, *args, **kwargs):
>> return Profile.objects.filter(sitename_id=self.kwargs['pk'])
>>
> You need to define the post() method yourself, 
>
>>
>> def show_site(request):
>> form = SelectSite()
>> if request.method == 'POST':
>> form = SelectSite(request.POST)
>> if form.is_valid():
>> pass
>> else:
>> form = SelectSite()
>> return render(request, 'app/home.html', {'form': form})
>>
>> home.html
>> {% extends 'app\base.html' %}
>>
>> {% block title %}Site Home{% endblock %}
>> {% block content %}
>> This Form is Terrible
>> {% csrf_token %}
>>  {{form}} 
>> 
>> 
>> {% endblock %}
>>
>> Any guidance would be greatly appreciated.
>>
>> Thank You
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/10be0e68-da3f-42cd-a095-96d6d2a5617f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/10be0e68-da3f-42cd-a095-96d6d2a5617f%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba1394b9-1fde-442e-9d4d-e67e32b2f694%40googlegroups.com.


understanding urls, forms, and HTTP ERROR 405

2020-02-20 Thread Phil Kauffman
Hello,

Newbie in need of a little shove. It seems I need to review the purpose of 
the urls.py file. At present I am getting an HTTP Error 405 with the 
following:

urls.py:
path('', views.show_site, name = 'home'),
path('site-view', views.List.as_view(), name='site-view')

views.py
class List(ListView):
def get_queryset(self, *args, **kwargs):
return Profile.objects.filter(sitename_id=self.kwargs['pk'])
def show_site(request):
form = SelectSite()
if request.method == 'POST':
form = SelectSite(request.POST)
if form.is_valid():
pass
else:
form = SelectSite()
return render(request, 'app/home.html', {'form': form})

home.html
{% extends 'app\base.html' %}

{% block title %}Site Home{% endblock %}
{% block content %}
This Form is Terrible
{% csrf_token %}
 {{form}} 


{% endblock %}

Any guidance would be greatly appreciated.

Thank You

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/10be0e68-da3f-42cd-a095-96d6d2a5617f%40googlegroups.com.


Re: How to pass pk through URL to CreateView

2020-02-18 Thread Phil Kauffman
Hello,

Did you get any headway on this issue? I'm a novice Django user but was 
thinking of doing something similar with my code for a project I'm working 
on. I'm struggling with reverse lookup on foreign key.

Have you had any issues doing reverse lookup on FK? 

For example in a view if you wanted to filter the Jobs class by 
Company_Name, by using a pk, is that working for you?



Thanks


On Friday, February 14, 2020 at 10:19:04 PM UTC-5, Sam Hefer wrote:

> Hi,
>
> I'm trying to figure out how to fill a form field in the background using 
> form_valid. However, everything I've tried doesn't work.
>
> As you can see in the model, there is a job field with a foreign key to 
> Job. 
>
> class JobDocket(models.Model):
> EQUIPMENT_TYPE = (
> ('1', 'Air Conditioning'),
> ('2', 'Heating/Heat-Pump'),
> ('3', 'Refrigeration'),
> ('4', 'Ventilation/Extraction'),
> ('5', 'Electrical/Controls'),
> )
>
> job = models.ForeignKey(Job, on_delete=models.CASCADE)
> technician = models.ForeignKey(User, on_delete=models.CASCADE)
> site_equipment = models.CharField(choices=EQUIPMENT_TYPE, max_length=50, 
> default='1')
> date = models.DateField(default=date.today())
> start_time = models.TimeField()
> end_time = models.TimeField()
> rate = models.FloatField(default=80.00)
> mileage = models.IntegerField()
> description = models.CharField(max_length=1000, help_text='Description of 
> work carried out', blank=False)
> created = models.DateTimeField(default=now, blank=True)
>
> def total_time_spent(self):
> start_hour = self.start_time.hour
> end_hour = self.end_time.hour
> start_min = self.start_time.minute
> end_min = self.end_time.minute
> total_hours = str(end_hour - start_hour)
> total_min = str(end_min - start_min)
> total_time = total_hours + " hours" " and " + total_min + " minutes"
> return total_time
>
> def total_labour_price(self):
> start_hour = self.start_time.hour
> end_hour = self.end_time.hour
> start_min = self.start_time.minute
> end_min = self.end_time.minute
> total_hours = end_hour - start_hour
> total_min = end_min - start_min
> total_time = total_hours + total_min/60
> labour_price = total_time * self.rate
> return labour_price
>
> def __str__(self):
> return str(self.technician)
>
> def get_absolute_url(self):
> return reverse('jobs:detail', kwargs={'pk': self.pk})
>
>
>
> In the View, I'm trying to get the pk for the job to automatically fill 
> the field so that the logged in user doesn't have to.
>
> class JobDocketCreate(CreateView):
> model = JobDocket
> form_class = JobDocketForm
> template_name = 'jobs/job_docket_create.html'
>
> def get_success_url(self):
> return reverse('jobs:my_job_dockets')
>
> def form_valid(self, form):
> form.instance.technician = self.request.user
> # form.instance.job_id = Job.objects.get(pk=self.kwargs['job_id'])
>  # print(form.instance.job_id)
> return super(JobDocketCreate, self).form_valid(form)
>
> def get_initial(self):
> Job.objects.get(pk=self.kwargs.get('job_id'))
> initial = super(JobDocketCreate, self).get_initial()
> initial['job'] = Job.objects.get(pk=self.kwargs['job_id'])
> print(initial)
> return initial
>
>
> I've tried passing the pk of the job through the URL like so;
>
> path('/jobdocketcreate/', JobDocketCreate.as_view(), 
> name='create_job_docket'),
>
>
> I have the template link referencing the job like this;
>
> Add Job 
> Docket
>
>
>
> But I can't get it to work, the error I keep getting is;
>
> NoReverseMatch at /jobs/1/jobdocketcreate/ 
>
> Reverse for 'create_job_docket' with arguments '('',)' not found. 1 
> pattern(s) tried: ['jobs\\/(?P[0-9]+)\\/jobdocketcreate\\/$']
>
>
> Has anyone got experience making this work? How did you do it?
>
> Here is the Job model if you need it;
>
> class Job(models.Model):
> JOB_TYPE = (
> ('1', 'Service'),
> ('2', 'Repair'),
> ('3', 'Quotation'),
> ('4', 'Consultation'),
> ('5', 'Report'),
> ('6', 'Design'),
> )
>
> ACCOUNT_TYPE = (
> ('1', 'Existing Customer'),
> ('2', 'Charge to Account'),
> ('3', 'New Customer'),
> ('4', 'Pre-Paid/C.O.D'),
> ('5', 'Issued and Acc App'),
> )
>
> company_name = models.ForeignKey(Company, related_name='jobs', 
> verbose_name="Company Name", on_delete=models.CASCADE)
> contact_person = models.CharField(max_length=50)
> contact_number = models.IntegerField()
> contact_person_email = models.EmailField(max_length=100, blank=True, 
> null=True)
> site_address = models.CharField(max_length=100)
> job_type = models.CharField(choices=JOB_TYPE, max_length=50, default='1')
> account_type = 

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

2020-02-13 Thread Phil Kauffman
Bill,

Thank You for taking the time to respond. I will definitely need to read up 
on the options you presented. My first inclination was to get familiar with 
the first option as it seems easiest. However, now that you mention VueJS I 
will look into that as well.

On Wednesday, February 12, 2020 at 6:46:42 PM UTC-5, ke1g wrote:

> 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. When the user clicks, it's on a link, and you reload the page with 
>the filter applied.  No JavaScript required.  Pretty slow.  more network 
>load, more browser load, and more load on the server.  (I'm not going into 
>the old approach of having an iframe and the link reloads the iframe 
>because iframes are tricky, and if you're showing a big table, it's most 
> of 
>the page anyway.)  Do be sure that your images, CSS files, and JavaScript 
>files are set to encourage the browser and/or the network to cache them, 
>but the HTML will load every time, and the URL will likely show the filter 
>settings (though you can do things with cookies and/or session store, but 
>you will surprise your users someday.
>2. Load all the data in the first place, and use JavaScript in 
>combination with CSS to hide the stuff that's filtered out.  If you go 
> this 
>way, do arrange to use CSS controlled by a class on a single containing 
>element to control visibility, because doing big DOM modifications in 
>JavaScript performs poorly.  This is the snappiest approach, but you have 
>to have loaded everything, at cost of network and server load, even if you 
>expect the user to filter later, and at the cost of RAM in the browser.  
> If 
>the data's not that big, this is fine.  But if it's the catalog of a 
>hardware chain or something else huge, you probably be doing it in pages.  
>Sometimes it's natural.  For example, I once did and event calendar for a 
>school system.  I loaded a month at a time, and filtering within the month 
>was peppy, but to go to a different month required a reload, and you 
>couldn't show stuff from multiple months at one time.
>3. Use an AJAX request to replace part of the DOM with filtered data.  
>(The iframe hack is very much like this.)  If the data is most of your 
>page, this isn't much more light weight than option 1, but the user 
> doesn't 
>see the page reload, which seems to count for style points.
>
> There are JavaScript "frameworks" (e.g. VueJS) that will help you with 2 
> and especially 3, but you have to learn how to use the framework, and how 
> to connect it to Django.  Those are useful things to learn, but they're not 
> overnight reads, and can have performance pitfalls.
>
> Good luck, Bill
>
> On Wed, Feb 12, 2020 at 3:17 PM Phil Kauffman  > wrote:
>
>> Hello, I am struggling with trying to filter child objects based on 
>> parent object selection on index.html (sites.html in example). On my 
>> sites.html, I list the office sites and a button to click for each, upon 
>> clicking I want to load the profile list for users only at that site, 
>> presently it's loading all profiles for all sites, which I assume is 
>> because the profiles are loaded statically no matter which button is 
>> clicked on sites.html.
>>
>> I'm thinking I need a JS onclick event? 
>>
>> models.py:
>> class Site(models.Model):
>>
>> name = models.CharField(max_length=50)
>> date = models.DateField()
>> manager = models.CharField(max_length=50)
>> 
>> def save(self, *args, **kwargs):
>> super(Site, self).save(*args, **kwargs)
>>  
>> class Profile(models.Model):
>> Days = '1st'
>> Mids = '2nd'
>> Nights = '3rd'
>> Work_Schedule_Choices = [
>>   (Days, 'Day Shift'),
>>   (Mids, 'Mid Shift'),
>>   (Nights, 'Night Shift'),
>> ]   
>> sitename = models.ForeignKey(Site, on_delete=models.CASCADE)
>> title = models.CharField(max_length=100)
>> schedule = models.CharField(max_length=3,choices=
>> Work_Schedule_Choices,default=Days)
>> totalusers = models.PositiveSmallIntegerField(default=1, validators=[
>> MinValueValidator(1), MaxValueValidator(50)])
>>
>>
>>
>> views.py:
>> def sites(request):
>> sitelist = Site.objects.all()
>> return render (request, 'A

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

2020-02-12 Thread Phil Kauffman
Hello, I am struggling with trying to filter child objects based on parent 
object selection on index.html (sites.html in example). On my sites.html, I 
list the office sites and a button to click for each, upon clicking I want 
to load the profile list for users only at that site, presently it's 
loading all profiles for all sites, which I assume is because the profiles 
are loaded statically no matter which button is clicked on sites.html.

I'm thinking I need a JS onclick event? 

models.py:
class Site(models.Model):

name = models.CharField(max_length=50)
date = models.DateField()
manager = models.CharField(max_length=50)

def save(self, *args, **kwargs):
super(Site, self).save(*args, **kwargs)
 
class Profile(models.Model):
Days = '1st'
Mids = '2nd'
Nights = '3rd'
Work_Schedule_Choices = [
  (Days, 'Day Shift'),
  (Mids, 'Mid Shift'),
  (Nights, 'Night Shift'),
]   
sitename = models.ForeignKey(Site, on_delete=models.CASCADE)
title = models.CharField(max_length=100)
schedule = models.CharField(max_length=3,choices=Work_Schedule_Choices,
default=Days)
totalusers = models.PositiveSmallIntegerField(default=1, validators=[
MinValueValidator(1), MaxValueValidator(50)])



views.py:
def sites(request):
sitelist = Site.objects.all()
return render (request, 'App/sites.html', {'sitelist' : sitelist})

def sitedetail(request):
site = Site.objects.filter()
if request.method == 'GET':
return render(request, 'App/site-detail.html', {'site': site, 
'profile_set': Profile.objects.all()})


sites.html (index)
{% extends 'App\base.html' %}
{% load crispy_forms_tags %}
{% block title %}Site Home{% endblock %}
{% block content %}
{% for Site in sitelist %}


{{ Site.name }}
View
  

{% empty %}

  Sorry, you haven't created any sites yet.
  
Add Site
Add Site
  

{% endfor %}
  
{% endblock %}


site-detail.html
{% extends 'App\base.html' %}
{% load crispy_forms_tags %}
{% block title %}Site Detail{% endblock %}
{% block content %}
This web form sucks
 
  {% for profile in profile_set  %}
  {{ profile.title }}
  {% endfor %}
 
{% endblock %}






-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b4bd97c3-1a36-436d-823a-b4f7003a29d0%40googlegroups.com.


manage.py not able to run any commands

2019-12-17 Thread Phil Yang
Hi, 
All of a sudden, when I tried to run manage.py runserver, it didn't produce 
any output, and it didn't do anything. In fact, the manage.py script seems 
to not be able to run other commands, such as startapp or createsuperuser.

I've already used the command many times prior, and it has always worked 
perfectly. 

Yes, Python is installed (I can run other scripts), but manage.py seems to 
have an issue.

Thanks.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c4b172e2-15a9-4fbf-96b6-e137086f614e%40googlegroups.com.


manage.py can't run any commands

2019-12-17 Thread Phil Yang
Hi, 
The manage.py script for all my projects has suddenly stopped working. It 
can't run any commands, such as runserver or startapp.

Python is installed correctly; I have tested this with other scripts. I 
deleted Django and reinstalled, the problem still persists. 

Basically, whenever I run manage.py, there is no output.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c0c868e0-f780-43c0-aced-a7d2bfffdaf0%40googlegroups.com.


Trouble installing Django

2018-09-03 Thread Phil Campaigne
I have successfully installed python 3.7 and virtualenv. on my MACBook Pro 
with MAC High Sierra  10.6
Now I am having trouble installing Django 
I don't understand the error message I am getting...especially teh last 
line.


Owners-MacBook-Pro:realityBB owner$ pip install Django
Collecting Django
  Downloading 
https://files.pythonhosted.org/packages/f8/1c/31112c778b7a56ce18e3fff5e8915719fbe1cd3476c1eef557dddacfac8b/Django-1.11.15-py2.py3-none-any.whl
 (6.9MB)
100% || 7.0MB 2.2MB/s 
Requirement already satisfied: pytz in 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python 
(from Django) (2013.7)
Installing collected packages: Django
Could not install packages due to an EnvironmentError: [Errno 13] Permission 
denied: '/Library/Python/2.7/site-packages/Django-1.11.15.dist-info'
Consider using the `--user` option or check the permissions.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2d82fa91-1cd0-4a16-9ebd-568e7aeb8b2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Displaying single-line progress while a management command runs

2016-05-23 Thread Phil Gyford
Belated thanks for this Erik - that does work nicely. It gets
complicated/annoying trying to untangle other kinds of logging too,
including logging from third-party modules, but that's a separate problem :)

On 9 May 2016 at 21:33, Erik Cederstrand <erik+li...@cederstrand.dk> wrote:

>
> > Den 9. maj 2016 kl. 14.23 skrev Phil Gyford <gyf...@gmail.com>:
> >
> > I have a custom management command which calls a method in another
> class, which fetches lots of data from a third-party API. Fetching the data
> could take a few seconds or it could take over an hour, depending on the
> quantity.
> >
> > [...]
> > Things I've tried so far:
> >
> > 1) Using print(), e.g.:
> >
> > print('Fetched %d of %d' % (n, total), end='\r')
> >
> > In a loop, this nicely shows a single line that constantly updates with
> progress. But print() is nasty and when I run my unit tests, this output is
> displayed among the testing output. I assume it'll also be a pain to have
> that output when running the commands scheduled with cron (or whatever).
>
> I do this kind of progress reporting a lot. Usually, I get around the
> test/cron output pollution by adding a 'silent' argument to the management
> command which determines if the commend should print progress reports or
> not. See below.
>
> > 2) Using Django logging. This is "better" than print(), and doesn't mess
> up test output, but as far as I can tell there's no way to display a
> single, constantly updated, line showing progress. It's only going to show
> one line after another:
> >
> > Fetched 1 of 3000
> > Fetched 2 of 3000
> > Fetched 3 of 3000
>
> It's actually quite simple. You need to create a custom handler like so:
>
>   import logging
>   import time
>   from django.core.management.base import BaseCommand
>
>   class OverwriteHandler(logging.StreamHandler):
>   # The extra spaces wipe previous output in case your messages are
> wariable-width
>   terminator = ' '*80 + '\r'
>
>   log = logging.getLogger('')
>   h = OverwriteHandler()
>   log.addHandler(h)
>
>   class Command(BaseCommand):
> def handle(self, silent=False, **options):
>   log.setLevel(logging.DEBUG if silent else logging.INFO)
>   log.info('1 of 2')
>   time.sleep(1)
>   log.info('2 of 2')
>   time.sleep(1)
>
> If you want to mix normal and progress logging in your management command,
> you need to use two loggers with different handlers.
>
> Erik
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/463A7786-888C-4CB0-9C68-43F855401924%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.gyford.com/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAU%3D2qRf6c%3DU%3DRtTAa8838NvXzxgn_aA1AF7DBA62jHuB9MaPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Displaying single-line progress while a management command runs

2016-05-09 Thread Phil Gyford
I have a custom management command which calls a method in another class,
which fetches lots of data from a third-party API. Fetching the data could
take a few seconds or it could take over an hour, depending on the quantity.

I'd like to display progress on the command line, so the user knows the
command's still going but am struggling with a good way to do this.
Criteria:

a) A single line that updates as the task progresses.
b) That line doesn't display while running unit tests (or is very easy to
disable for tests).
c) That line doesn't display while running the command automatically (via
cron or whatever).

Things I've tried so far:

*1) Using print()*, e.g.:

print('Fetched %d of %d' % (n, total), end='\r')

In a loop, this nicely shows a single line that constantly updates with
progress. But print() is nasty and when I run my unit tests, this output is
displayed among the testing output. I assume it'll also be a pain to have
that output when running the commands scheduled with cron (or whatever).

*2) Using Django logging.* This is "better" than print(), and doesn't mess
up test output, but as far as I can tell there's no way to display a
single, constantly updated, line showing progress. It's only going to show
one line after another:

Fetched 1 of 3000
Fetched 2 of 3000
Fetched 3 of 3000

*3) Using tqdm* <https://pypi.python.org/pypi/tqdm>. Makes it easy to
display a command line progress bar but, again, I end up with loads of
progress bars displaying in my test output, and I assume it'll do the same
when scheduling the task to run.


Have I missed a standard way to do this? Or is there a way I haven't found
to easily suppress tqdm's output during tests and when running the task
scheduled? I can't be the first to have wanted this...

Thanks,
Phil

-- 
http://www.gyford.com/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAU%3D2qRS8_HBadL5Oqga8h8k7yRnuu2NHyH%2B60PT_-Pi7RyskQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to use apache instead of django_server

2014-12-29 Thread phil...@bailey.st
Sorry,

just forgot to attach the link

https://forge.puppetlabs.com/pbailey/django_bootstrap

Best,

Phillip

On 29/12/14 18:09, phil...@bailey.st wrote:
> 
> Hello there,
> 
> if you are familiar with puppet you can take a look to this module.
> 
> Best,
> 
> Phillip
> 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54A19A40.30700%40bailey.st.
For more options, visit https://groups.google.com/d/optout.


Re: how to use apache instead of django_server

2014-12-29 Thread phil...@bailey.st

Hello there,

if you are familiar with puppet you can take a look to this module.

Best,

Phillip



On 29/12/14 17:26, th.gran...@free.fr wrote:
> Merci
> Thanks
> 
> just another question
> 
> when you don't use apache but the internal server of Django you start
> the command runserver for loging to django admin
> how to connect with apache?
> 
> Many thanks
> 
> T.
> 
> Le lundi 29 décembre 2014 13:11:01 UTC+1, th.gr...@free.fr a écrit :
> 
> Hello
> 
> i'm a very new user of python and i'd luke to install Django
> i want to use apache server instead of the internal Django server.
> 
> i read the documentation and installed wsgi
> but now i don't know how to connect Django admin via apache!!
> 
> thanks for your help
> 
> T

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54A198D9.30501%40bailey.st.
For more options, visit https://groups.google.com/d/optout.


Re: Any actual open project to create a company "social" network using Django?

2014-12-27 Thread phil...@bailey.st
On 26/12/14 16:31, Fellipe Henrique wrote:
> Hi,
> 
> There's any actual open project to create a company "social" network
> using Django? I search on google, and I don't find any project using
> django (or even other python framework)  only PHP or Ruby...
> 
> Thanks,
> 
> Cheers!
> 

Another simple tutorial is building ribbit in django.


http://code.tutsplus.com/tutorials/building-ribbit-in-django--net-29957

Best,

Phillip

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/549F0354.8090501%40bailey.st.
For more options, visit https://groups.google.com/d/optout.


Re: Any actual open project to create a company "social" network using Django?

2014-12-27 Thread phil...@bailey.st

Event though the following tutorial is not up to date with Django 1.7,
it is still quite understandable.

http://arunrocks.com/building-a-hacker-news-clone-in-django-part-1/


Best,

Phillip


On 27/12/14 17:10, Scot Hacker wrote:
> 
> 
> On Friday, December 26, 2014 8:31:16 AM UTC-8, Fellipe Henrique wrote:
> 
> Hi,
> 
> There's any actual open project to create a company "social" network
> using Django? I search on google, and I don't find any project using
> django (or even other python framework)  only PHP or Ruby...
> 
> 
> 
> The Pinax Project includes quite a few social features:
> http://pinaxproject.com/
> 
> See also the "Social" section of djangopackages.com:
> https://www.djangopackages.com/grids/g/social/ 
> 
> but  at the end  of the day, Django is more about helping you to build
> the features you need. You might start by creating a project that uses
> one of the social login modules (like django-allauth) and then integrate
> a simple Follow model with manytomany connections between users.
> 



-- 
www.bailey.st

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/549EFA3A.5020705%40bailey.st.
For more options, visit https://groups.google.com/d/optout.


TypeError: unbound method save() must be called with NagiosLog instance as first argument (got nothing instead)

2014-12-06 Thread Phil F
Hi,

I am attempting to write a python script that will populate the Django db 
from data stored in a dictionary.

I'm currently getting the error :"TypeError: unbound method save() must be 
called with NagiosLog instance as first argument (got nothing instead)"

from incidents.models import NagiosLog
import django
xcount = 0

for k,v in myDic.items():
iincidentnumber = k
itime =v[0]
idevice =v[2]
iservice =v[3]
iseverity =v[4]
imessage =v[5]
print "%r %r %r %r %r" % (itime,idevice,iservice,iseverity,imessage,) 
 ## prints successfully, code working until here
xcount= xcount+1
if xcount == 1:   # count to run django setup a single time
django.setup()
k = NagiosLog(
incident = iincidentnumber,
time = itime,
device = idevice,
service = iservice,
severity = iseverity,
message = imessage,)
NagiosLog.save()
else:
k = NagiosLog(
incident = iincidentnumber,
time = itime,
device = idevice,
service = iservice,
severity = iseverity,
message = imessage,)
NagiosLog.save()

This is my models file:

from django.db import models

from django.utils import timezone
import datetime

class NagiosLog(models.Model):
incident= models.CharField(primary_key=True, max_length=80)
time= models.CharField(max_length=80, blank=True, null=True)
device  = models.CharField(max_length=80, blank=True, null=True)
service = models.CharField(max_length=80, blank=True, null=True)
severity= models.CharField(max_length=20, blank=True, null=True)
message = models.CharField(max_length=250, blank=True, 
null=True)

Any help appreciated !

Thanks, Phil.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1cc3eda3-d180-430e-8e41-866dceb0bca2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.7 and Python 2.6

2014-09-27 Thread phil...@bailey.st

Hello there,

docker might do the job.

Cheers,

Phillip


On 27/09/14 20:42, Babatunde Akinyanmi wrote:
> Hi,
> If you can download in your server then you can install python 2.7+ into
> your virtenv.
> 
> On 27 Sep 2014 19:54, "François Schiettecatte"  > wrote:
> 
> Hi

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54271FDF.6090201%40bailey.st.
For more options, visit https://groups.google.com/d/optout.


referencing choices tuples

2014-01-08 Thread Phil Hughes
I have a typical set of choices tuples that are then referenced in a 
choices=... reference in a field definition. It does, well, what it is 
supposed to do.

But, I have a situation where I need to change the value of the field to "a 
different choice" in code in the view (rather than as a from choice).
It seems like it should be trivial but, for some reason, my brain is not 
creating the right code.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b093cb06-d6f0-4611-9c0b-06e36f4f2fab%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ForeignKey pointing to "nothing"

2014-01-04 Thread Phil Hughes
That was it -- thanks. I usually create a MySQL database to use in 
development but decided to just use sqlite. So much for my "shortcut".

On Saturday, January 4, 2014 4:26:59 AM UTC-6, Russell Keith-Magee wrote:
>
>
> On Sat, Jan 4, 2014 at 9:57 AM, Phil Hughes <nic...@gmail.com
> > wrote:
>
>> I have a model where a foreign key reference may be undefined when a
>> record is first created. In particular, I have the following in my model
>>  seller = models.ForeignKey(User, related_name='+', blank=True,
>>  null=True)
>>
>> The form accepts not setting the seller field but I get an Integrity
>> Error exception when I attempt to save it that says
>> escrow_escrow.seller_id may not be NULL
>>
>> I am using SQLite. What did I miss?
>>
>>  Was the null=True restriction in place when you created the table? If 
> you ran syncdb and *then* added the null=True definition, the null=True 
> definition won't be picked up by the  database - you'll need to do a table 
> migration. However, it *will* be picked up by forms, as they read the model 
> definition as-is.
>
> Migrating tables is a bit painful on SQLite; it will probably be easier to 
> just drop the table and recreate it. If you need to preserve data in the 
> table, you can use the dumpdata/loaddata management commands.
>
> Yours,
> Russ Magee %-)
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/41c25ceb-0266-4b32-986a-552fa0f95ee3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ForeignKey pointing to "nothing"

2014-01-03 Thread Phil Hughes


I have a model where a foreign key reference may be undefined when a
record is first created. In particular, I have the following in my model
 seller = models.ForeignKey(User, related_name='+', blank=True,
 null=True)

The form accepts not setting the seller field but I get an Integrity
Error exception when I attempt to save it that says
escrow_escrow.seller_id may not be NULL

I am using SQLite. What did I miss?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a545abf-6dde-4eb4-9e66-6d6f990e5521%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: not able to run applets

2013-08-05 Thread Phil
How are you invoking the applet? Could you show your relevant code 
(template)?

Regards,
Phil

On Monday, August 5, 2013 5:08:12 AM UTC-3, Kaushik Roy wrote:
>
> hello everyone,
>
> i am a new user of django and i am doing a small project for my course. i 
> can show static content like images, css and scripts, but 
> my applets are not running at all. i have a simple hello world applet and 
> its not showing. could anyone throw some light on this? its important for 
> me.
>
> is there any difference between how normal static content and applets are 
> dealt with?
>
> cheers,
> Kaushik
>

-- 
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: Can't run manage.py runserver (Django 1.5.1)

2013-08-05 Thread Phil
Without knowing more what you are doing, it is hard to help. But it seems 
like you are trying to decode as utf-8 something encoded differently. 
Please provide more information about what you are doing with Django.

Regards,
Phil

On Sunday, August 4, 2013 3:38:11 PM UTC-3, Anton Yermolenko wrote:
>
> Hi guys
>
> i'm new to python as well as django. Seeking help for this problem
>
> I have python 3.3 installed and django 1.5.1 on win 7
> so when i run manage.py runserver i got this error message
>
> c:\mysite>python manage.py runserver
> Validating models...
>
> 0 errors found
> August 04, 2013 - 18:51:37
> Django version 1.5.1, using settings 'mysite.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> Error: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start 
> byte
>
> Googling didn't help, unfortunately
>

-- 
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: Admin Center is not displaying

2013-08-05 Thread Phil
There are 3 steps in the documentation. You seem to have done the first 2, 
but what about your mysite/urls.py file? Did you uncomment those lines:

# Uncomment the next two lines to enable the admin:*from django.contrib import 
admin**admin.autodiscover()*

Regards,
Phil

On Sunday, August 4, 2013 12:57:33 AM UTC-3, Cole Calhoun wrote:
>
> I am running Python 2.7.4 and Django 1.5.1 on a Mac.
>
> I completed the first part of the "Writing your first Django app." 
> tutorial (https://docs.djangoproject.com/en/1.5/intro/tutorial01/) and 
> everything went as the tutorial explained. Once I got to the second part of 
> the tutorial, it asked me to add /admin/ to my local dev url, nothing 
> rendered. I didn't receive any errors in the terminal, but the site stayed 
> the same, I saw no changes.
>
> One thing I did notice while going through the tutorial was that in 
> mysite/settings.py the django.contrib.app was not included. Once I noticed 
> that, I added it, synced the database again, but it still wouldn't work. 
> The tutorial says that it is meant for version 1.5 and 2.+ and I am running 
> 1.5.1.
>
> If anyone has any insight as to what the problem may be, that would be 
> greatly appreciated.
>
> Thanks!
>
>

-- 
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: Importing project URLs without a database

2013-08-01 Thread Phil
Could you post the entire content of your script? There is no way those 2 
lines (and the necessary "os" import) can cause this error.

Regards,
Phil

On Thursday, August 1, 2013 5:39:46 PM UTC-3, Jon Dufresne wrote:
>
> Hi,
>
> I am trying to write a script that outputs information about all URLs in 
> the project. The script should be able to do this without having a database 
> populated or even created.
>
> Right now the script gets to the following line:
>
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
> from project import urls
>
> However, this raises an exception _mysql_exceptions.OperationalError: 
> (1049, "Unknown database 'project'").
>
> It appears that Django is trying to connect to the database, but all I 
> want to do is analyze the URLs. Is this possible?
>

-- 
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: I all django's user I'm new here and also new to Python+ django technology. but i wanna learn phython........

2013-08-01 Thread Phil
Hi,

There are lots of excellent resources online to learn Django. I am myself 
going through that process. 

The best place to get started is, of course, the excellent Django 
documentation: https://docs.djangoproject.com/en/1.5/intro/tutorial01/

Finally, once you have a good grasp on the basics, I would recommend the 
excellent https://django.2scoops.org/. Their book will really take you to 
the next level, and if you can't afford to buy it, they will give it you 
for free. In the same vein, http://www.deploydjango.com/ is very 
interesting. Of course Google will yield tons of other interesting blogs on 
the topic.

For Python itself, http://learnpythonthehardway.org/ or (my favourite) 
http://www.diveintopython.net/ are excellent resources to get you started.

Regards,
Phil

On Thursday, August 1, 2013 6:28:48 AM UTC-3, Rakesh Balhara wrote:
>
> I all django's user I'm new here and also new to Python+ django 
> technology. but i wanna learn phython and i hv to make a project in this 
> technology so plzz tell me where from i start to learning i just want 
> to learn it within one week...
>

-- 
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:

2013-07-30 Thread Phil
Shouldn't you dedicate a specific path to your flat pages, like this: 
(r'^pages/', include('django.contrib.flatpages.urls'))? The 
documentation<https://docs.djangoproject.com/en/dev/ref/contrib/flatpages/>also 
indicates that you can use a "catchall" pattern, but AFTER any other 
URL patterns.

I am not a Django expert by any mean, but I don't think (r'', 
include('django.contrib.flatpages.urls')) works, since the regex is empty...

Regards,
Phil

On Tuesday, July 30, 2013 1:02:53 PM UTC-3, Robin Lery wrote:
>
>
>
> -- Forwarded message --
> From: Robin Lery <robi...@gmail.com >
> Date: Tue, Jul 30, 2013 at 9:22 PM
> Subject: 
> To: django...@googlegroups.com 
>
>
> Hello,
> I am stuck at a point where i should be able to type in a search query on 
> the page and it django should get back a list of matching pages if any. But 
> it doesnt show me any pages, even though its there, and gives me an erros:
>
> Page not found (404)
> Request Method: GET  Request URL: 
> http://127.0.0.1:8000/search/?csrfmiddlewaretoken=W6n1O1vQCMyDojxEkR4mPnRrVz9lYVt1=one
>   
>  
> No FlatPage matches the given query.
>
> Please point me as to where am doing wrong. Thank you.
>
> *my views.py:*
>
> from django.http import HttpResponse
> from django.template import loader, Context
> from django.contrib.flatpages.models import FlatPage
>
> def search(request):
> query = request.GET['q']
>  resuts = FlatPage.objects.filter(content__icontains=query)
> template = loader.get_template('search/search.html')
>  context = Context({
> 'query':query,
> 'resuts':resuts
>  })
> response = template.render(context)
> return HttpResponse(response)
>
> *urls.py:*
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> (r'^tinymce/(?P.*)$', 'django.views.static.serve', { 
> 'document_root': 'C:/Users/Kakar/web/cms/static/js/tinymce/' }),
> (r'', include('django.contrib.flatpages.urls')),
> (r'^search/$', 'search.views.search'),
> )
>
> *settings.py:*
> In the installed-apps, I have installed 'search'.
>
> *default.html:*
>
> 
> 
>  {{ flatpage.title }}
> 
> 
>  
> {% csrf_token %}
> Search:
>  
> 
>  
> {{ flatpage.title }}
> {{ flatpage.content }}
>  
> 
>
> *search.html:*
>
> 
> 
>  Search
> 
> 
>  You searched for "{{query}}"; the results are listed below.
> {% if results %}
>  
> {% for page in results %}
> 
>  {{page.title}}
> 
> {% endfor %}
>  
> {% else %}
> No results.
>  {% endif %}
> 
> 
> *
> *
>
>

-- 
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: Error.

2013-07-27 Thread Phil
How did you start your server? Using a command line such as "python 
manage.py runserver"? Or through your IDE (PyCharm, Eclipse, etc...)? 
Somewhere you mush have a window showing this kind of information:

Validating models...

0 errors found
July 27, 2013 - 12:33:15
Django version 1.5.1, using settings 'foo.settings.local'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Note that if will be slightly different if you are using gunicorn or 
something else. Also, make sure your settings file contains "DEBUG = True".

Regards,
Phil

On Saturday, July 27, 2013 8:45:39 AM UTC-3, Nigel Legg wrote:
>
> Running locally on windows7. Where would I find the logs?
> On 27 Jul 2013 12:42, "Roberto López López" <robert...@uni.no> 
> wrote:
>
>>  Well, I suppose you are running that locally or have access to the 
>> server. So show the logs.
>>
>>
>>
>> On 07/27/2013 01:40 PM, Nigel Legg wrote:
>>  
>> I have provided all the information I have. That's all there is on the 
>> screen in the browser. There is no trace.
>> On 27 Jul 2013 12:26, "Roberto López López" <robert...@uni.no> 
>> wrote:
>>
>>>
>>> Could be. But if you don't provide more information (i.e. detailed
>>> information about how you get that error, error stacktrace, logs), you
>>> won't get an answer.
>>>
>>>
>>> On 07/27/2013 01:21 PM, Nigel Legg wrote:
>>> > I've just set up a new view / url etc, which has quite a bit of
>>> > processing behind it.  When I click on the link for it, I get the
>>> > "Connecting" message for a few minutes, and then just "A server error
>>> > has occurred. Please contact the administrator." appears.  Is this a
>>> > time out message?
>>> > Regards,
>>> > Nigel Legg
>>> > 07914 740972
>>> > http://www.trevanianlegg.co.uk
>>> > http://twitter.com/nigellegg
>>> > http://uk.linkedin.com/in/nigellegg
>>> >
>>> > --
>>> > 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...@googlegroups.com .
>>> > To post to this group, send email to 
>>> > django...@googlegroups.com
>>> .
>>> > Visit this group at http://groups.google.com/group/django-users.
>>> > For more options, visit https://groups.google.com/groups/opt_out.
>>> >
>>> >
>>>
>>>
>>> --
>>>
>>> Roberto López López
>>> System Developer
>>> Parallab, Uni Computing
>>> +47 55584091
>>>
>>> --
>>> 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...@googlegroups.com .
>>> To post to this group, send email to django...@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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>>
>> -- 
>>
>> Roberto López López
>> System Developer
>> Parallab, Uni Computing+47 55584091
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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: linux or windows

2013-05-31 Thread phil...@bailey.st

forgot to include a vagrant video how-to

http://www.youtube.com/watch?v=MiRMvB65U1Y

Best,

Phillip


On 31/05/13 21:53, phil...@bailey.st wrote:
> Hi Kakar,
> 
> if you want to use Linux within Window, I strongly advise you to
> use Vagrant http://docs-v1.vagrantup.com/v1/docs/getting-started/
> 
> Vagrant will bring up and running a Linux virtual server within minutes.
> 
> Best,
> 
> Phillip
> 
> 
> On 31/05/13 12:11, Kakar Arunachal Service wrote:
>> Hi!
>> I know this question is one absurd question, but just out of curiosity,
>> is it important to use linux other than the windows, related to django.
>> Cause i'm in windows, and if it is, then i was thinking to use Ubuntu.
>> Please advise.
>>
>> -- 
>> 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.
>>  
>>  
> 
> 


-- 
www.bailey.st

-- 
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.




Re: linux or windows

2013-05-31 Thread phil...@bailey.st
Hi Kakar,

if you want to use Linux within Window, I strongly advise you to
use Vagrant http://docs-v1.vagrantup.com/v1/docs/getting-started/

Vagrant will bring up and running a Linux virtual server within minutes.

Best,

Phillip


On 31/05/13 12:11, Kakar Arunachal Service wrote:
> Hi!
> I know this question is one absurd question, but just out of curiosity,
> is it important to use linux other than the windows, related to django.
> Cause i'm in windows, and if it is, then i was thinking to use Ubuntu.
> Please advise.
> 
> -- 
> 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.
>  
>  


-- 
www.bailey.st

-- 
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.




Re: Why Postgres over Mysql?

2013-05-17 Thread phil...@bailey.st

Hi frocco,

Mysql was recently aquired by Oracle and the future isn't very bright
for the database. So, if you have an application already using MySQL
you can easly switch to mariadb https://mariadb.org/ or percona server
www.percona.com. If you are starting a new project I strongly advise you
to go for PostgreSQL.

Below you can find a few articles on the topic.

Replacing MySQL with MariaDB

http://www.openlogic.com/wazi/bid/272031/Replacing-MySQL-with-MariaDB

MySQL vs postgresql:

http://www.openlogic.com/wazi/bid/188125/PostgreSQL-vs-MySQL-Which-Is-the-Best-Open-Source-Database


Best,

Phillip


On 17/05/13 20:38, frocco wrote:
> My site is currently using Mysql, would it benefit me to switch to Postgres?
> 
> Thanks
> 
> -- 
> 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.
>  
>  


-- 
www.bailey.st

-- 
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.




Re: How to Handle XML and CSV processing in Django

2013-05-14 Thread phil...@bailey.st
On 14/05/13 18:41, Muhammad Ali wrote:
> Thanks a lot for these resources. 
> 
> All the best, 
> Muhammad
> 


Hi Muhammad,

if you have a csv dataset you can try to import the data into mysql
following my short tutorial.


http://bailey.st/blog/2012/02/22/bits-of-python-import-a-csv-file-into-a-mysql-database/


Best,

Phillip


-- 
www.bailey.st

-- 
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.




Re: Accessing django development server using internet

2013-05-11 Thread phil...@bailey.st
On 07/05/13 17:38, Kakar wrote:
> I have my project in my pc, and on python manage.py runserver, i can view it 
> on my browser. But how to view from other computer or on the internet and not 
> locally?... How to make my pc a server to view it from over the internet? Plz 
> help me guyz!
> 

I Kakar,

you can try www.heroku.com to deploy publicly your sample code.

Best,
Phillip



-- 
www.bailey.st

-- 
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.




How best to cache a queryset of Comments?

2013-03-14 Thread Phil Gyford
I have a site that uses the standard Django Comments app (well, a subclass
of it, with not many changes) for comments on different content types.

I'd like to be able to cache a list of comments, as fetching the comments
is one of the most frequent and slowest queries that's happening at the
moment.

But I can't see the simplest way to perform this caching. (I'm already
using the per-site cache for logged-out users and per-view cache on a few
views, using memcache.)

At the moment the queryset comes from RenderCommentListNode's render()
method <
https://github.com/django/django/blob/stable/1.5.x/django/contrib/comments/templatetags/comments.py#L200>
So I could subclass RenderCommentListNode, copy the render() method, and
add caching there... but it feels a bit clunky and hacky compared to most
customising I end up doing with Django these days... so is this the
best/only way?

Phil

-- 
http://www.gyford.com/

-- 
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.




Re: empty static_url

2013-03-06 Thread Phil
Hi Tom,

Thanks a million for the reply, you helped solve my issue.

Technically speaking, if that is your template, and you end up with 
"/css/style.css", then STATIC_URL is not empty, it is '/'. 

Yeah sorry, I should have just had "css/style.css" as I wasn't even getting 
the forward slash.

Yes thats correct, 1 project with 3 apps etc. I just changed the last line 
in my view(that wasn't working, not the 2 generic view ones) from...

return render_to_response('sales/index.html', {'sales_list': sales_list})

to...

return render_to_response('sales/index.html', {'sales_list': 
sales_list},context_instance=RequestContext(request))

and that did the job. Thanks again.





On Monday, March 4, 2013 2:33:50 PM UTC, Tom Evans wrote:
>
> On Sat, Mar 2, 2013 at 4:47 PM, Phil <phi...@gmail.com > 
> wrote: 
> > Hi, 
> > 
> > I'm using django1.4.3 
> > 
> > I have a django project with 3 apps. All 3 apps templates extend 
> 'app.html'. 
> > On 2 of my projects the CSS loads fine, but on third one the CSS doesn't 
> get 
> > loaded because it's not adding '/static/' to the url to the CSS. So 
> instead 
> > of '/static/css/style.css' I'm getting '/css/style.css' ... 
> > 
> >  
>
> Technically speaking, if that is your template, and you end up with 
> "/css/style.css", then STATIC_URL is not empty, it is '/'. 
>
> > 
> > STATIC_URL is working on the 2 projects that use generic views, but not 
> on 
> > the other one. So how can 'STATIC_URL' be blank and how can this be 
> fixed? I 
> > tried adding the following to my index.html template but no joy... 
> > 
> > {% load static %} 
> > {% get_static_prefix as STATIC_PREFIX %} 
> > 
>
> To clarify - you only have one project, with three apps in it. In two 
> of the apps, which only use generic views, STATIC_URL works correctly, 
> but in third app it does not. 
>
> Do these views in the third app use RequestContext to render the 
> templates? Generic views do… 
>
> Cheers 
>
> Tom 
>

-- 
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.




empty static_url

2013-03-02 Thread Phil
Hi,

I'm using django1.4.3

I have a django project with 3 apps. All 3 apps templates extend 
'app.html'. On 2 of my projects the CSS loads fine, but on third one the 
CSS doesn't get loaded because it's not adding '/static/' to the url to the 
CSS. So instead of '/static/css/style.css' I'm getting '/css/style.css' ...



STATIC_URL is working on the 2 projects that use generic views, but not on 
the other one. So how can 'STATIC_URL' be blank and how can this be fixed? 
I tried adding the following to my index.html template but no joy...

{% load static %}
{% get_static_prefix as STATIC_PREFIX %}

-- 
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.




django setup advice for AWS Elastic Beanstalk

2013-02-03 Thread Phil
Hi,

I am following the steps here to setup django on aws...
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

I got as far as step 6 but when I "git aws.push" I never see the django "it 
worked" page, only the green beanstalk page. I'm sure where I've gone wrong 
is where Ive placed particular files/ folders so was just looking for some 
advice/ clarification on where everything should be.

So I created my virtualenv("~/web/mysiteenv/"), activate it, pip installs 
etc. From inside that folder I create my djangoproject("mysite"). So the 
files/ folders I'm unsure about are the following:


   1. I run "git init" from "~/web/mysiteenv/mysite"
   2. Where should beanstalk folder("AWS-ElasticBeanstalk-CLI-2.2") be? I 
   had it at "~/web/mysiteenv"
   3. I run "eb start" from "~/web/mysiteenv/mysite"
   4. Where should I run "mkdir .ebextensions", I ran it inside 
   "~/web/mysiteenv/mysite" I put the config file in the ".ebextensions" 
   folder.

If anyone can see where I've gone wrong I would be very grateful to you. 
I've deleted the project so I can start over. 








-- 
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.




Re: virtualenv setup

2012-12-29 Thread Phil
Hi,

Thanks for reply. Yeah I activated the source(terminal has "venv" beside my 
username). I followed instructions here(so I pip installed django etc after 
getting virtualenv up and running)...

https://devcenter.heroku.com/articles/django#prerequisites

If I runserver thats when I get the error. If I runserver without 
activating source it works fine but that would be using my system wide 
python. Just need to figure out how to get it to recognise the virtualenv 
python.


On Saturday, December 29, 2012 10:16:45 PM UTC, quinonesvictor wrote:
>
> Hi Phil
>
> sorry for the question, but, did you activate your virtualenv source?
> $ source bin/activate (?)
>
> Anyway, I'd try to install django via pip once you I have my virtualenv 
> created and activated.
>
> Cheers
>
> On Sat, Dec 29, 2012 at 7:01 PM, Phil <phi...@gmail.com >wrote:
>
>> Hi,
>>
>> I have python/django working system wide. But am currently looking into 
>> using Heroku for a new project so am trying to get virtualenv setup for the 
>> first time. When I run "django-admin.py startproject whatever" it creates 
>> the project ok, but then when I run "python manage.py runserver 8080" from 
>> the project folder I get the following error...
>>
>> ImportError: No module named django.core.management
>>
>> Is it because at the top of my "manage.py" it is pointing to my system 
>> wide python(#!/usr/bin/env python) instead of my virtualenv one? If so how 
>> do I fix this? I tried changing the path at the top of the manage.py file 
>> but didn't seem to do anything.
>>  
>> -- 
>> 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/-/n4-fu8ioveIJ.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> Quiñones Victor Manuel
> Tel: +54 0362 15 4 880839
> Resistencia - 3500
> Argentina 
>

-- 
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/-/Gb4JYmpcK-0J.
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.



virtualenv setup

2012-12-29 Thread Phil
Hi,

I have python/django working system wide. But am currently looking into 
using Heroku for a new project so am trying to get virtualenv setup for the 
first time. When I run "django-admin.py startproject whatever" it creates 
the project ok, but then when I run "python manage.py runserver 8080" from 
the project folder I get the following error...

ImportError: No module named django.core.management

Is it because at the top of my "manage.py" it is pointing to my system wide 
python(#!/usr/bin/env python) instead of my virtualenv one? If so how do I 
fix this? I tried changing the path at the top of the manage.py file but 
didn't seem to do anything.

-- 
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/-/n4-fu8ioveIJ.
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 message on runserver locally

2012-12-15 Thread Phil Brant
ah that worked. I have apache on port 80 so I didn't see my django site, so
I just tried a different port and all my django sites work on the new port
now. I always used port 8080 before I wonder why it doesn't work anymore.
Anyway working again, thanks a million devan!


On Sat, Dec 15, 2012 at 4:25 PM, Dev <devans...@gmail.com> wrote:

> Run from command line:
> "python manage.py runserver"
>
> Also i guess you are getting an import error because your 'path
> environment variable' doesn't contain the path of the directory of your
> project.
>
> Sent from my iPhone
>
> On 15-Dec-2012, at 9:34 PM, Phil Brant <phil...@gmail.com> wrote:
>
> OK, thanks for your help anyway.
>
>
> On Sat, Dec 15, 2012 at 3:57 PM, Ramiro Morales <cra...@gmail.com> wrote:
>
>>
>> On Dec 15, 2012 11:30 AM, "Phil" <phil...@gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > I had django setup and working for over a year now working with it on
>> and off. I was away for a month, came back and now whenever I run
>> "django-admin.py runserver 8080" I get the following error...
>> >
>> > ImportError: Settings cannot be imported, because environment variable
>> DJANGO_SETTINGS_MODULE is undefined.
>> >
>> > I can import django from command line(version 1.4.3), I ran
>> "django-admin.py startproject test" to try a new project. It has
>> "os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")" declared
>> in "manage.py" in the root and in "test/test/wsgi.py" it's also declared so
>> how is my DJANGO_SETTINGS_MODULE undefined?
>>
>> Hace you by chance actually upgraded Django todo 1.4.x from aún older
>> versión? Are you using Mac OS X?
>>
>> --
>> 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.
>>
>
>
>
> --
> Kind Regards,
> Philip Brant.
>
> --
> 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.
>



-- 
Kind Regards,
Philip Brant.

-- 
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 message on runserver locally

2012-12-15 Thread Phil Brant
OK, thanks for your help anyway.


On Sat, Dec 15, 2012 at 3:57 PM, Ramiro Morales <cra...@gmail.com> wrote:

>
> On Dec 15, 2012 11:30 AM, "Phil" <phil...@gmail.com> wrote:
> >
> > Hi,
> >
> > I had django setup and working for over a year now working with it on
> and off. I was away for a month, came back and now whenever I run
> "django-admin.py runserver 8080" I get the following error...
> >
> > ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
> >
> > I can import django from command line(version 1.4.3), I ran
> "django-admin.py startproject test" to try a new project. It has
> "os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")" declared
> in "manage.py" in the root and in "test/test/wsgi.py" it's also declared so
> how is my DJANGO_SETTINGS_MODULE undefined?
>
> Hace you by chance actually upgraded Django todo 1.4.x from aún older
> versión? Are you using Mac OS X?
>
> --
> 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.
>



-- 
Kind Regards,
Philip Brant.

-- 
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 message on runserver locally

2012-12-15 Thread Phil Brant
Running that in python interpreter just throws an error "Invalid Syntax"


On Sat, Dec 15, 2012 at 3:29 PM, Xavier Ordoquy <xordo...@linovia.com>wrote:

>
> Sorry I should have been more explicit. You need to call the manage.py
> through the python interpreter: "python manage.py runserver" because your
> local directory isn't in your paths.
>
> Regards,
> Xavier Ordoquy,
> Linovia.
>
> Le 15 déc. 2012 à 16:14, Phil Brant <phil...@gmail.com> a écrit :
>
> I tried "manage.py runserver 8080" there just get "command not found".
> I've never done it that way in the past but doesn't work either.
>
>
> On Sat, Dec 15, 2012 at 3:09 PM, Xavier Ordoquy <xordo...@linovia.com>wrote:
>
>>
>> Have you tried to start them with the manage.py runserver instead of
>> django-admin ?
>>
>> Regards,
>> Xavier Ordoquy,
>> Linovia.
>>
>> Le 15 déc. 2012 à 15:38, Phil <phil...@gmail.com> a écrit :
>>
>> Hi Xavier, I tried a project called "boom" too and same message, plus my
>> other 3 django projects I had working previously all get the same error now.
>>
>> On Saturday, December 15, 2012 2:34:48 PM UTC, Xavier Ordoquy wrote:
>>>
>>> Hi Phil,
>>>
>>> test is a python module. Your project name conflicts with it.
>>> You should use another name for your project.
>>>
>>> Regards,
>>> Xavier Ordoquy,
>>> Linovia.
>>>
>>
>> --
>> 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/-/kFwQlmOsSQgJ.
>> 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.
>>
>
>
>
> --
> Kind Regards,
> Philip Brant.
>
> --
> 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.
>



-- 
Kind Regards,
Philip Brant.

-- 
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 message on runserver locally

2012-12-15 Thread Phil Brant
I tried "manage.py runserver 8080" there just get "command not found". I've
never done it that way in the past but doesn't work either.


On Sat, Dec 15, 2012 at 3:09 PM, Xavier Ordoquy <xordo...@linovia.com>wrote:

>
> Have you tried to start them with the manage.py runserver instead of
> django-admin ?
>
> Regards,
> Xavier Ordoquy,
> Linovia.
>
> Le 15 déc. 2012 à 15:38, Phil <phil...@gmail.com> a écrit :
>
> Hi Xavier, I tried a project called "boom" too and same message, plus my
> other 3 django projects I had working previously all get the same error now.
>
> On Saturday, December 15, 2012 2:34:48 PM UTC, Xavier Ordoquy wrote:
>>
>> Hi Phil,
>>
>> test is a python module. Your project name conflicts with it.
>> You should use another name for your project.
>>
>> Regards,
>> Xavier Ordoquy,
>> Linovia.
>>
>
> --
> 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/-/kFwQlmOsSQgJ.
> 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.
>



-- 
Kind Regards,
Philip Brant.

-- 
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 message on runserver locally

2012-12-15 Thread Phil
Hi Xavier, I tried a project called "boom" too and same message, plus my 
other 3 django projects I had working previously all get the same error now.

On Saturday, December 15, 2012 2:34:48 PM UTC, Xavier Ordoquy wrote:
>
> Hi Phil, 
>
> test is a python module. Your project name conflicts with it. 
> You should use another name for your project. 
>
> Regards, 
> Xavier Ordoquy, 
> Linovia. 
>

-- 
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/-/kFwQlmOsSQgJ.
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.



error message on runserver locally

2012-12-15 Thread Phil
Hi,

I had django setup and working for over a year now working with it on and 
off. I was away for a month, came back and now whenever I run 
"django-admin.py runserver 8080" I get the following error...

ImportError: Settings cannot be imported, because environment variable 
DJANGO_SETTINGS_MODULE is undefined.

I can import django from command line(version 1.4.3), I ran 
"django-admin.py startproject test" to try a new project. It has 
"os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")" declared 
in "manage.py" in the root and in "test/test/wsgi.py" it's also declared so 
how is my DJANGO_SETTINGS_MODULE undefined?

-- 
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/-/DKnfFKq7KcQJ.
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: Having LiveServerTestCase use same database as tests

2012-10-21 Thread Phil Gyford
No, I'm afraid not. I didn't get any replies (nor to a StackOverflow
question http://stackoverflow.com/q/12041315/250962 ) and haven't gone
back to try again. I'd tried everything I could think of already. Good
luck, and let us know if you get anywhere!


-- Forwarded message --
From: Дмитрий Белавенцев <dizp...@gmail.com>
Date: 21 October 2012 09:43
Subject: Re: Having LiveServerTestCase use same database as tests
To: django-users@googlegroups.com
Cc: p...@gyford.com


Hi, Phil! I faced the same problem. Do you find the solution?

вторник, 21 августа 2012 г., 22:24:59 UTC+7 пользователь Phil Gyford написал:
>
> I'm writing integration tests using LiveServerTestCase/Selenium in
> v1.4.1. By default the process that's started by LiveServerTestCase
> uses a different database to the test database used by the tests. This
> is a pain because I can't use factories (I'm using FactoryBoy at the
> moment) to create data to then test in the browser.
>
> Is there a way I can get LiveServerTestCase using the same database as
> the tests themselves?
>
> Thanks,
> Phil
>
> --
> http://www.gyford.com/

--
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/-/cgi4pq5P9nUJ.
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.


-- 
http://www.gyford.com/

-- 
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.contrib.markup deprecated in 1.5 - what's the alternative?

2012-09-16 Thread Phil Gyford
Thanks for the pointer Jirka - I hadn't managed to find that ticket.
Makes sense and, like you, I only have a few trusted users entering
text that will be filtered.

On 15 September 2012 19:37, Jirka Vejrazka <jirka.vejra...@gmail.com> wrote:
> Hi Phil,
>
>   incidentally, I was looking at this just recently. The
> contrib.markup was deprecated mainly due to security issues with 3rd
> party libraries that could not be fixed in Django itself and were
> compromising its security. For more, read
> https://code.djangoproject.com/ticket/18054
>
>   Can't tell you what the replacement is. I rolled up my own markup
> filter, but I only have a handful of trusted users for my web app so I
> don't have to be too concerned with trusting their inputs.
>
>   You can copy the markup filter from 1.4 - just be aware of the
> security consequences.
>
>   HTH
>
> Jirka
>
> --
> 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.
>



-- 
http://www.gyford.com/

-- 
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.



django.contrib.markup deprecated in 1.5 - what's the alternative?

2012-09-15 Thread Phil Gyford
I noticed that django.contrib.markup is marked as deprecated in Django
1.5 . If
I'm starting a new project now, what alternative should I be using, to
avoid running into problems with future versions of Django? I could
write my own Markdown (or whatever) filter, but I wondered if there
was going to be a standard replacement built-in?

For bonus points - why are those filters being deprecated?

-- 
http://www.gyford.com/

-- 
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: setting up Django Compressor

2012-09-05 Thread Phil
Hi Joni,

Yes I have 'compressor.finders.CompressorFinder' added. All the 
requirements are installed too I double checked them all, tried installing 
them all individually and it said they were all installed already. When I 
first setup the site it was using django1.3, but recently upgraded it. 

My static url setting is

STATIC_URL = '/media/'

and media is(for local setup)...

MEDIA_URL = 'http://127.0.0.1:8080/media/'

Not sure what's going on, might just try another compressor at this stage 
as I am not having any joy with this one.



On Sunday, September 2, 2012 3:38:27 PM UTC+1, Joni Bekenstein wrote:
>
> Just to cover the basics, did you follow all installation steps described 
> here:
> http://django_compressor.readthedocs.org/en/latest/quickstart/#installation
>
> Mainly adding 'compressor.finders.CompressorFinder' to STATICFILES_FINDERS
>
>
> Another thing kind of odd is that your css URL starts with /media/. Whats 
> your STATIC_URL and MEDIA_URL setting? Check this out: 
> http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_URL
>
> It looks like its defaulting to MEDIA_URL, but you said you were using 
> Django 1.4, which should have STATIC_URL available.
>
>
> On Sunday, September 2, 2012 11:13:53 AM UTC-3, Phil wrote:
>>
>> Hi Joni,
>>
>> Thanks a million for reply.
>>
>> Yes I am using django runserver, its a working site just trying to get 
>> compressor working locally before moving to production. My css works fine 
>> without the compressor app. I can't see the file if I copy it in my url I 
>> get a 500 error and the "CACHE" folder doesn't seem to exist anywhere. I 
>> didn't have anything in my "urls.py" for media, but I added the following 
>> to see if it would help but it still didn't work...
>>
>> ***
>> if settings.DEBUG:
>> urlpatterns = patterns('',
>> url(r'^media/(?P.*)$', 'django.views.static.serve',
>> {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
>> url(r'', include('django.contrib.staticfiles.urls')),
>> ) + urlpatterns
>> ***
>>
>>
>>
>> On Saturday, September 1, 2012 3:09:42 PM UTC+1, Joni Bekenstein wrote:
>>>
>>> The generated css file seems to be in your media directory. If you copy 
>>> that URL, can you see the css file? Are you using Django's dev server 
>>> (runserver)? If so, did you add to your urls.py a view to serve the media 
>>> files? (and that view should only exist when DEBUG is true since in 
>>> production you're probably going to serve static files and media files 
>>> directly with your webserver)
>>
>>

-- 
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/-/bfE-bHAJpOkJ.
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: setting up Django Compressor

2012-09-02 Thread Phil
Hi Joni,

Thanks a million for reply.

Yes I am using django runserver, its a working site just trying to get 
compressor working locally before moving to production. My css works fine 
without the compressor app. I can't see the file if I copy it in my url I 
get a 500 error and the "CACHE" folder doesn't seem to exist anywhere. I 
didn't have anything in my "urls.py" for media, but I added the following 
to see if it would help but it still didn't work...

***
if settings.DEBUG:
urlpatterns = patterns('',
url(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns
***



On Saturday, September 1, 2012 3:09:42 PM UTC+1, Joni Bekenstein wrote:
>
> The generated css file seems to be in your media directory. If you copy 
> that URL, can you see the css file? Are you using Django's dev server 
> (runserver)? If so, did you add to your urls.py a view to serve the media 
> files? (and that view should only exist when DEBUG is true since in 
> production you're probably going to serve static files and media files 
> directly with your webserver)

-- 
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/-/2QOYzFLa-f0J.
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: How sitemaps used in the Django

2012-08-31 Thread Phil
nearly forgot, also in urls.py...

(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': 
sitemaps}),

On Friday, August 31, 2012 10:04:26 AM UTC+1, Mugdha wrote:
>
> Please help me in generating site maps for app. which is in django.
>

-- 
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/-/yrioUkQZcFAJ.
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: How sitemaps used in the Django

2012-08-31 Thread Phil
Hi Mugdha,

First add 'django.contrib.sitemaps' to your installed apps.

Then create a file "sitemap.py" in your project root with something like


from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
from blog.models import Entry

class ViewSitemap(Sitemap):
"""Reverse static views for XML sitemap."""
def items(self):
# Return list of url names for views to include in sitemap
return ['home']

def location(self, item):
return reverse(item)

class BlogSitemap(Sitemap):
changefreq = "never"
priority = 0.5

def items(self):
return Entry.objects.filter(status=1)

def lastmod(self, obj):
return obj.pub_date


sitemaps = {'views': ViewSitemap,
   'blog_posts': BlogSitemap,
  }
***

in urls.py...
**
from project.sitemap import sitemaps
.
url('^$', home, name='home'),
etc...


On Friday, August 31, 2012 10:04:26 AM UTC+1, Mugdha wrote:
>
> Please help me in generating site maps for app. which is in django.
>

-- 
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/-/QOnbgyvZ9qAJ.
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.



setting up Django Compressor

2012-08-31 Thread Phil
Hi,

Django1.4, Python2.7

I am currently trying to get django compressor to work locally, I installed 
django_compressor via pip install earlier, added it to my installed apps. 
Here is a copy of my base template


{% load i18n %}
{% load compress %}





  



{% compress css %}

{% endcompress %}
.



When I view the source it outputs the following

**

  http://127.0.0.1:8080/media/CACHE/css/fbe3d01c9f33.css>" 
type="text/css" media="all" />


**


So it is creating the cached css file, but it doesn't seem to be able to 
find it(ie page loads with no style applied to it), any ideas what it could 
be that I am missing?


-- 
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/-/qpwRn4wDPycJ.
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.



Having LiveServerTestCase use same database as tests

2012-08-21 Thread Phil Gyford
I'm writing integration tests using LiveServerTestCase/Selenium in
v1.4.1. By default the process that's started by LiveServerTestCase
uses a different database to the test database used by the tests. This
is a pain because I can't use factories (I'm using FactoryBoy at the
moment) to create data to then test in the browser.

Is there a way I can get LiveServerTestCase using the same database as
the tests themselves?

Thanks,
Phil

-- 
http://www.gyford.com/

-- 
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: Mac.... Won't Download, sync to python, or install... please help

2012-08-18 Thread phil archambault
I figured it out. Thanks. I ran all the source scripts separately and it 
didn't work, but with I entered the source scripts into the terminal all at 
once for some reason it magically worked.

I know what I'm talking about. No need to return with discontent. I've been 
at this for computer business for a while.

On Saturday, August 18, 2012 5:54:43 PM UTC-4, Amyth wrote:
>
> what do you meant by "django to go into python" ?? Once you execute 
> "python setup.py install " from the django package it automatically 
> install django inside python 'site-packages'. ?? 
>
> On Sun, Aug 19, 2012 at 3:19 AM, phil archambault 
> <philipi...@gmail.com > wrote: 
> > 
> > 
> > On Saturday, August 18, 2012 5:46:53 PM UTC-4, phil archambault wrote: 
> >> 
> >> 
> >> 
> >> On Saturday, August 18, 2012 5:32:26 PM UTC-4, Daniel Roseman wrote: 
> >>> 
> >>> On Saturday, 18 August 2012 22:12:58 UTC+1, phil archambault wrote: 
> >>>> 
> >>>> 
> >>>> 
> >>>> On Saturday, August 18, 2012 5:02:03 PM UTC-4, Thomas wrote: 
> >>>>> 
> >>>>> 
> >>>>> On 2012-08-18, at 1:28 PM, phil archambault wrote: 
> >>>>> 
> >>>>> > Hey django users I'm trying to figure out how to dl and install 
> >>>>> > django into py, but I'm not having any luck with this issue. I 
> have followed 
> >>>>> > the directions down to the tee and issue still stands, any help 
> help would 
> >>>>> > be greatly appreciated! 
> >>>>> 
> >>>>> Not sure what instructions you are following, and whether they are 
> >>>>> actually done the tee. You need to be more specific to get help. 
> >>>>> 
> >>>>> If your instructions do not happen to use virtualenv you might want 
> to 
> >>>>> find new instructions, especially if you are new at this. It makes 
> it much 
> >>>>> easier to get a consistent installation. 
> >>>>> 
> >>>>> hth 
> >>>>> 
> >>>>>- Tom 
> >>>> 
> >>>> 
> >>>> I followed the instruction on this page 
> >>>> https://www.djangoproject.com/download/ and I made sure my version 
> of python 
> >>>> was greater then 2.5. 
> >>> 
> >>> 
> >>> 
> >>> Good. So since you followed the instructions exactly, and haven't 
> >>> mentioned any errors or issues, we must presume that your Django 
> >>> installation was successful and you are now ready to write your first 
> app. 
> >>> Well done. 
> >>> -- 
> >>> DR. 
> >>> 
> >>> 
> > 
> > 
> > 
> > 
> > I'm still have issues. I have both python and django down loaded, 
> but I 
> > can't get django to go into python 
> > 
> > : sudo tar xzvf django.tar.gz 
> > tar: Error opening archive: Failed to open 'django.tar.gz' 
> > 
> > 
> > -- 
> > 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/-/OQvTbPFPlQgJ. 
> > 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>
>
>
> -- 
> Thanks & Regards 
>  
>
> Amyth [Admin - Techstricks] 
> Email - aroras@gmail.com , 
> ad...@techstricks.com 
> Twitter - @a_myth_ 
> http://techstricks.com/ 
>

-- 
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/-/TgTIILN7HpsJ.
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: Mac.... Won't Download, sync to python, or install... please help

2012-08-18 Thread phil archambault


On Saturday, August 18, 2012 5:54:43 PM UTC-4, Amyth wrote:
>
> what do you meant by "django to go into python" ?? Once you execute 
> "python setup.py install " from the django package it automatically 
> install django inside python 'site-packages'. ?? 
>
> On Sun, Aug 19, 2012 at 3:19 AM, phil archambault 
> <philipi...@gmail.com > wrote: 
> > 
> > 
> > On Saturday, August 18, 2012 5:46:53 PM UTC-4, phil archambault wrote: 
> >> 
> >> 
> >> 
> >> On Saturday, August 18, 2012 5:32:26 PM UTC-4, Daniel Roseman wrote: 
> >>> 
> >>> On Saturday, 18 August 2012 22:12:58 UTC+1, phil archambault wrote: 
> >>>> 
> >>>> 
> >>>> 
> >>>> On Saturday, August 18, 2012 5:02:03 PM UTC-4, Thomas wrote: 
> >>>>> 
> >>>>> 
> >>>>> On 2012-08-18, at 1:28 PM, phil archambault wrote: 
> >>>>> 
> >>>>> > Hey django users I'm trying to figure out how to dl and install 
> >>>>> > django into py, but I'm not having any luck with this issue. I 
> have followed 
> >>>>> > the directions down to the tee and issue still stands, any help 
> help would 
> >>>>> > be greatly appreciated! 
> >>>>> 
> >>>>> Not sure what instructions you are following, and whether they are 
> >>>>> actually done the tee. You need to be more specific to get help. 
> >>>>> 
> >>>>> If your instructions do not happen to use virtualenv you might want 
> to 
> >>>>> find new instructions, especially if you are new at this. It makes 
> it much 
> >>>>> easier to get a consistent installation. 
> >>>>> 
> >>>>> hth 
> >>>>> 
> >>>>>- Tom 
> >>>> 
> >>>> 
> >>>> I followed the instruction on this page 
> >>>> https://www.djangoproject.com/download/ and I made sure my version 
> of python 
> >>>> was greater then 2.5. 
> >>> 
> >>> 
> >>> 
> >>> Good. So since you followed the instructions exactly, and haven't 
> >>> mentioned any errors or issues, we must presume that your Django 
> >>> installation was successful and you are now ready to write your first 
> app. 
> >>> Well done. 
> >>> -- 
> >>> DR. 
> >>> 
> >>> 
> > 
> > 
> > 
> > 
> > I'm still have issues. I have both python and django down loaded, 
> but I 
> > can't get django to go into python 
> > 
> > : sudo tar xzvf django.tar.gz 
> > tar: Error opening archive: Failed to open 'django.tar.gz' 
> > 
> > 
> > -- 
> > 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/-/OQvTbPFPlQgJ. 
> > 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>
>
>
> -- 
> Thanks & Regards 
>  
>
> Amyth [Admin - Techstricks] 
> Email - aroras@gmail.com , 
> ad...@techstricks.com 
> Twitter - @a_myth_ 
> http://techstricks.com/ 
>

-- 
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/-/GZLdsu5eWKAJ.
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: Mac.... Won't Download, sync to python, or install... please help

2012-08-18 Thread phil archambault


On Saturday, August 18, 2012 5:46:53 PM UTC-4, phil archambault wrote:
>
>
>
> On Saturday, August 18, 2012 5:32:26 PM UTC-4, Daniel Roseman wrote:
>>
>> On Saturday, 18 August 2012 22:12:58 UTC+1, phil archambault wrote:
>>>
>>>
>>>
>>> On Saturday, August 18, 2012 5:02:03 PM UTC-4, Thomas wrote:
>>>>
>>>>
>>>> On 2012-08-18, at 1:28 PM, phil archambault wrote: 
>>>>
>>>> > Hey django users I'm trying to figure out how to dl and install 
>>>> django into py, but I'm not having any luck with this issue. I have 
>>>> followed the directions down to the tee and issue still stands, any help 
>>>> help would be greatly appreciated! 
>>>>
>>>> Not sure what instructions you are following, and whether they are 
>>>> actually done the tee. You need to be more specific to get help. 
>>>>
>>>> If your instructions do not happen to use virtualenv you might want to 
>>>> find new instructions, especially if you are new at this. It makes it much 
>>>> easier to get a consistent installation. 
>>>>
>>>> hth 
>>>>
>>>>- Tom
>>>
>>>
>>> I followed the instruction on this page 
>>> https://www.djangoproject.com/download/ and I made sure my version of 
>>> python was greater then 2.5. 
>>>
>>
>>
>> Good. So since you followed the instructions exactly, and haven't 
>> mentioned any errors or issues, we must presume that your Django 
>> installation was successful and you are now ready to write your first app. 
>> Well done.
>> --
>> DR. 
>>
>  
>>
>


I'm still have issues. I have both python and django down loaded, but I 
can't get django to go into python

: sudo tar xzvf django.tar.gz
tar: Error opening archive: Failed to open 'django.tar.gz'
 

-- 
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/-/OQvTbPFPlQgJ.
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: Mac.... Won't Download, sync to python, or install... please help

2012-08-18 Thread phil archambault


On Saturday, August 18, 2012 5:32:26 PM UTC-4, Daniel Roseman wrote:
>
> On Saturday, 18 August 2012 22:12:58 UTC+1, phil archambault wrote:
>>
>>
>>
>> On Saturday, August 18, 2012 5:02:03 PM UTC-4, Thomas wrote:
>>>
>>>
>>> On 2012-08-18, at 1:28 PM, phil archambault wrote: 
>>>
>>> > Hey django users I'm trying to figure out how to dl and install django 
>>> into py, but I'm not having any luck with this issue. I have followed the 
>>> directions down to the tee and issue still stands, any help help would be 
>>> greatly appreciated! 
>>>
>>> Not sure what instructions you are following, and whether they are 
>>> actually done the tee. You need to be more specific to get help. 
>>>
>>> If your instructions do not happen to use virtualenv you might want to 
>>> find new instructions, especially if you are new at this. It makes it much 
>>> easier to get a consistent installation. 
>>>
>>> hth 
>>>
>>>- Tom
>>
>>
>> I followed the instruction on this page 
>> https://www.djangoproject.com/download/ and I made sure my version of 
>> python was greater then 2.5. 
>>
>
>
> Good. So since you followed the instructions exactly, and haven't 
> mentioned any errors or issues, we must presume that your Django 
> installation was successful and you are now ready to write your first app. 
> Well done.
> --
> 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/-/iivJXHFtjyAJ.
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: Mac.... Won't Download, sync to python, or install... please help

2012-08-18 Thread phil archambault


On Saturday, August 18, 2012 5:02:03 PM UTC-4, Thomas wrote:
>
>
> On 2012-08-18, at 1:28 PM, phil archambault wrote: 
>
> > Hey django users I'm trying to figure out how to dl and install django 
> into py, but I'm not having any luck with this issue. I have followed the 
> directions down to the tee and issue still stands, any help help would be 
> greatly appreciated! 
>
> Not sure what instructions you are following, and whether they are 
> actually done the tee. You need to be more specific to get help. 
>
> If your instructions do not happen to use virtualenv you might want to 
> find new instructions, especially if you are new at this. It makes it much 
> easier to get a consistent installation. 
>
> hth 
>
>- Tom


I followed the instruction on this page 
https://www.djangoproject.com/download/ and I made sure my version of 
python was greater then 2.5. 

-- 
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/-/ynfG_ayWiw4J.
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.



Mac.... Won't Download, sync to python, or install... please help

2012-08-18 Thread phil archambault
Hey django users I'm trying to figure out how to dl and install django into 
py, but I'm not having any luck with this issue. I have followed the 
directions down to the tee and issue still stands, any help help would be 
greatly appreciated!

-- 
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/-/r9SI6ZFvgyYJ.
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: html compress advice

2012-07-26 Thread Phil
ah, thank you. I'll take a look now.

On Thursday, July 26, 2012 10:34:49 PM UTC+1, mhulse wrote:
>
> Hi, 
>
> > Just looking for some advice/ wisdom really. 
>
> While not a direct answer to your question, there was a discussion on 
> the group recently on the topic of the spaceless tag: 
>
> "{% spaceless %} abuse (?)" 
>  
>
> You might find some wisdom there. :) 
>

-- 
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/-/lmKrWiGYzTMJ.
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.



html compress advice

2012-07-26 Thread Phil
Hi,

Just looking for some advice/ wisdom really.

I have compressed my css/js files and am now looking to strip all the white 
space from the html in the templates to help speed things up as much as 
possible. Is putting my hole base.html file between django's "spaceless" 
template tag an ok way of going about this or would that slow things/ make 
much difference down in the long run?

-- 
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/-/15DFNIBBk80J.
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.



model translationissue

2012-07-12 Thread Phil
Hi,

I'm trying to translate form names from a model. I have a working contact 
form for example and have the following code



from django import forms
from django.core.mail import mail_managers
from django.utils.translation import ugettext_lazy as _

class ContactForm(forms.Form):
name = forms.CharField(_('name'), max_length=100)


==

It adds it to my .po file ok, but when I run it in the browser I get the 
following error...


Environment:


Request Method: GET
Request URL: http://127.0.0.1:8080/contact/

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.formtools',
 'django.contrib.admindocs',
 'tagging',
 'blog']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django_mobile.middleware.MobileDetectionMiddleware',
 'django_mobile.middleware.SetFlavourMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response
  101. request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in resolve
  250. for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in _get_url_patterns
  279. patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in _get_urlconf_module
  274. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
import_module
  35. __import__(name)
File "/home/phil/project/urls.py" in 
  2. from views import *
File "/home/phil/project/views.py" in 
  7. from forms import ContactForm
File "/home/phil/project/forms.py" in 
  5. class ContactForm(forms.Form):
File "/home/phil/project/forms.py" in ContactForm
  6. name = forms.CharField(_('name'), max_length=100)

Exception Type: TypeError at /contact/
Exception Value: __init__() got multiple values for keyword argument 
'max_length'


-- 
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/-/m5L_nLBNK6cJ.
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-admin.py makemessages issue

2012-07-12 Thread Phil
Now I'm getting the following error...

Error: errors happened while running xgettext on __init__.py
/bin/sh: 1: xgettext: not found


It creates the right folders, but no .mo files.


On Thursday, July 12, 2012 7:13:14 PM UTC+1, Phil wrote:
>
> ugh, that would explain it! Thanks a lot Tomas.
>
> On Thursday, July 12, 2012 7:02:11 PM UTC+1, Tomas Neme wrote:
>>
>> "django-admin.py makemessages -l de" 
>> "django-admin.py makemessages -l es" 
>>
>>
>> > Hi, 
>> > 
>> > (django version 1.3.1, Python2.7) 
>> > 
>> > (at the end of my settings file) 
>> >  
>> > # translation support 
>> > ugettext = lambda s: s 
>> > 
>> > LANGUAGES = ( 
>> > ('en', ugettext('English')), 
>> > ('es', ugettext('Spanish')), 
>> > ('de', ugettext('German')), 
>> > ) 
>> > 
>> > LOCALE_PATHS = ( 
>> > '/home/phil/project/locale', 
>> > ) 
>> >  
>> > 
>> > I am implementing languages into my django website. It's working fine 
>> but 
>> > when I run "django-admin.py makemessages" on the command line it gives 
>> the 
>> > following error 
>> > 
>> > "Error: This script should be run from the Django SVN tree or your 
>> project 
>> > or app tree. If you did indeed run it from the SVN checkout or your 
>> project 
>> > or application, maybe you are just missing the conf/locale (in the 
>> django 
>> > tree) or locale (for project and application) directory? It is not 
>> created 
>> > automatically, you have to create it by hand if you want to enable i18n 
>> for 
>> > your project or application." 
>> > 
>> > So like it says, I create the "locale" folder manually then(it's in the 
>> root 
>> > of my project directory) run makemessages again but I just get another 
>> error 
>> > saying... 
>> > 
>> > "Error: Type 'django-admin.py help makemessages' for usage 
>> information." 
>> > 
>> > Any idea's where I could be going wrong? 
>> > 
>> > -- 
>> > 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/-/IukJjVtKua4J. 
>> > 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. 
>>
>>
>>
>> -- 
>> "The whole of Japan is pure invention. There is no such country, there 
>> are no such people" --Oscar Wilde 
>>
>> |_|0|_| 
>> |_|_|0| 
>> |0|0|0| 
>>
>> (\__/) 
>> (='.'=)This is Bunny. Copy and paste bunny 
>> (")_(") to help him gain world domination. 
>>
>

-- 
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/-/FylY8YehSxgJ.
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-admin.py makemessages issue

2012-07-12 Thread Phil
ugh, that would explain it! Thanks a lot Tomas.

On Thursday, July 12, 2012 7:02:11 PM UTC+1, Tomas Neme wrote:
>
> "django-admin.py makemessages -l de" 
> "django-admin.py makemessages -l es" 
>
>
> > Hi, 
> > 
> > (django version 1.3.1, Python2.7) 
> > 
> > (at the end of my settings file) 
> >  
> > # translation support 
> > ugettext = lambda s: s 
> > 
> > LANGUAGES = ( 
> > ('en', ugettext('English')), 
> > ('es', ugettext('Spanish')), 
> > ('de', ugettext('German')), 
> > ) 
> > 
> > LOCALE_PATHS = ( 
> > '/home/phil/project/locale', 
> > ) 
> >  
> > 
> > I am implementing languages into my django website. It's working fine 
> but 
> > when I run "django-admin.py makemessages" on the command line it gives 
> the 
> > following error 
> > 
> > "Error: This script should be run from the Django SVN tree or your 
> project 
> > or app tree. If you did indeed run it from the SVN checkout or your 
> project 
> > or application, maybe you are just missing the conf/locale (in the 
> django 
> > tree) or locale (for project and application) directory? It is not 
> created 
> > automatically, you have to create it by hand if you want to enable i18n 
> for 
> > your project or application." 
> > 
> > So like it says, I create the "locale" folder manually then(it's in the 
> root 
> > of my project directory) run makemessages again but I just get another 
> error 
> > saying... 
> > 
> > "Error: Type 'django-admin.py help makemessages' for usage information." 
> > 
> > Any idea's where I could be going wrong? 
> > 
> > -- 
> > 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/-/IukJjVtKua4J. 
> > 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. 
>
>
>
> -- 
> "The whole of Japan is pure invention. There is no such country, there 
> are no such people" --Oscar Wilde 
>
> |_|0|_| 
> |_|_|0| 
> |0|0|0| 
>
> (\__/) 
> (='.'=)This is Bunny. Copy and paste bunny 
> (")_(") to help him gain world domination. 
>

-- 
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/-/VTaFRRrgGVAJ.
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.



django-admin.py makemessages issue

2012-07-12 Thread Phil
Hi,

(django version 1.3.1, Python2.7)

(at the end of my settings file)

# translation support
ugettext = lambda s: s

LANGUAGES = (
('en', ugettext('English')),
('es', ugettext('Spanish')),
('de', ugettext('German')),
)

LOCALE_PATHS = (
'/home/phil/project/locale',
)


I am implementing languages into my django website. It's working fine but 
when I run "django-admin.py makemessages" on the command line it gives the 
following error

"Error: This script should be run from the Django SVN tree or your project 
or app tree. If you did indeed run it from the SVN checkout or your project 
or application, maybe you are just missing the conf/locale (in the django 
tree) or locale (for project and application) directory? It is not created 
automatically, you have to create it by hand if you want to enable i18n for 
your project or application."

So like it says, I create the "locale" folder manually then(it's in the 
root of my project directory) run makemessages again but I just get another 
error saying...

"Error: Type 'django-admin.py help makemessages' for usage information."

Any idea's where I could be going wrong?

-- 
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/-/IukJjVtKua4J.
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.



multiple valuesfor keyword arguement 'prefix'

2012-02-16 Thread Phil
Hi,

I have a basic django blog built and am now trying to use generic views in 
it but am getting the following error, I'm not sure where I am going wrong:


Environment:


Request Method: GET
Request URL: http://127.0.0.1:8080/blog/

Django Version: 1.3.1
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.formtools',
 'django.contrib.admindocs',
 'tagging',
 'blog']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response
  101. request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in resolve
  252. sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in resolve
  250. for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in _get_url_patterns
  279. patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in _get_urlconf_module
  274. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
import_module
  35. __import__(name)
File "/home/phil/mydev/projects/job/blog/urls.py" in 
  15. 
(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$', 
'object_detail', entry_info_dict, 'blog_entry_detail', {'template_name': 
'blog/detail.html'}),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/defaults.py" 
in patterns
  24. t = url(prefix=prefix, *t)

Exception Type: TypeError at /blog/
Exception Value: url() got multiple values for keyword argument 'prefix'


**

my 'urls.py':


from django.conf.urls.defaults import *
from blog.models import Entry

entry_info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
(r'^$', 'archive_index', entry_info_dict, 'blog_entry_archive_index', 
{'template_name': 'blog/index.html'}),
(r'^(?P\d{4})/$', 'archive_year', entry_info_dict, 
'blog_entry_archive_year'),
(r'^(?P\d{4})/(?P\w{3})/$', 'archive_month', 
entry_info_dict, 'blog_entry_archive_month'),
(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$', 'archive_day', 
entry_info_dict, 'blog_entry_archive_day'),

(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$', 
'object_detail', entry_info_dict, 'blog_entry_detail', {'template_name': 
'blog/detail.html'}),
)



*

end of 'Entry' in models.py:

"""
def get_absolute_url(self):
return ('blog_entry_detail', (), {'year': 
self.pub_date.strftime("%Y"),
'month': 
self.pub_date.strftime("%b").lower(),
'day': self.pub_date.strftime("%d"),
'slug': self.slug})
get_absolute_url = models.permalink(get_absolute_url)

-- 
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/-/TbcBxu_Es-IJ.
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: "manage.py" command not found

2011-08-30 Thread Phil
I opened my "manage.py" file to insert the line, but it was already there on 
the first line.


-- 
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/-/uXSA23Fl7iEJ.
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: "manage.py" command not found

2011-08-30 Thread Phil
The permissions were OK, but putting python in front of it seems to have 
worked(I have database connection issue now, but once I fix that I reckon it 
will be work)!

Thanks Yves, big 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/-/Y0D0NYyo4Q8J.
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.



"manage.py" command not found

2011-08-30 Thread Phil
Hi,

I'm running the latest django 1.4 alpha from the repository.

I have a django project hosted on bitbucket, I run the bitbucket "clone" 
command and pull down my code onto my server. But when I go into my project 
folder and run the command...

"./manage.py runfcgi method=threaded host=127.0.0.1 port=8080"

I get the following error...

"manage.py: command not found"

If I start a project directly on my server running the "startproject" 
command it works fine, it's only when I clone a project onto my server I get 
this.

Is there anything I can do to make my cloned projects work? As I need to be 
able to pull the latest project versions from my repositories.

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/-/14GRq9ygTJsJ.
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: login auth issue - beginner

2011-08-20 Thread Phil
Thanks for reply. 

Yes my form is using POST. Here is my template file...

{% block content %}

  {% if form.errors %}
Sorry, that's not a valid username or password
  {% endif %}

  
User name:

Password:




  

{% endblock %}

-- 
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/-/N7rqZwk4FCsJ.
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.



login auth issue - beginner

2011-08-20 Thread Phil
Hi, 

I am new to Django and am trying to use the built in auth features for the 
first time. I have been following the steps on the djangobook website 
here... 

http://www.djangobook.com/en/1.0/chapter12/ 

However I am getting the following error on my login page. Anyone know where 
I am going wrong?... 


Environment: 


Request Method: GET 
Request URL: http://127.0.0.1:8080/login/ 

Django Version: 1.3 
Python Version: 2.7.1 
Installed Applications: 
['django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.sites', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'django.contrib.admin', 
'django.contrib.admindocs', 
'healthapp', 
'healthapp.myhealth'] 
Installed Middleware: 
('django.middleware.common.CommonMiddleware', 
'django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.messages.middleware.MessageMiddleware') 


Traceback: 
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response 
111. response = callback(request, *callback_args, **callback_kwargs) 
File "/home/phil/mydev/projects/healthapp/../healthapp/views.py" in login 
16. username = request.POST['username'] 
File "/usr/local/lib/python2.7/dist-packages/django/utils/datastructures.py" 
in __getitem__ 
256. raise MultiValueDictKeyError("Key %r not found in %r" % (key, self)) 

Exception Type: MultiValueDictKeyError at /login/ 
Exception Value: "Key 'username' not found in " 

-- 
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/-/9zw1FCvQ33kJ.
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: get django/lighttpd "hello world" page

2011-07-20 Thread Phil
thanks Javier.

On Jul 20, 8:13 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote:
> On Wed, Jul 20, 2011 at 2:02 PM, Phil <phil...@gmail.com> wrote:
> >            "host" => "my ip address",
>
> sometimes flup (and other fastcgi launchers) bind only to the
> 127.0.0.1 IP.  if you want to put the webserver and webapp on
> different machines, be sure to bind to all IPs (typically setting "0"
> as IP on the launcher).  if both webserver and webapp are on the same
> machine, faster and safer is to use 127.0.0.1 (and even faster and
> safer is to use socket files)
>
> --
> Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Phil
thanks Javier! I switched it to port 8080 now.

I have a "lighttpd/lighttpd.conf" with the following...

server.document-root = "/var/www"

$HTTP["host"] =~ "(^|\.)mydomain\.com$" {
fastcgi.server = (
"/var/www/mydomain.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "my ip address",
"port" => 8080,
#"socket" => "/home/user/mysite.sock",
#"check-local" => "disable",
)
),
)
}


But I also have a "lighttpd/conf-enabled/10-fastcgi.conf" file with
the following

server.modules += ( "mod_fastcgi" )

$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".py" => "/usr/bin/python" )
}

## Warning this represents a security risk, as it allow to execute any
file
## with a .pl/.php/.py even outside of /usr/lib/cgi-bin.
#
cgi.assign  = (
#   ".pl"  => "/usr/bin/perl",
#   ".php" => "/usr/bin/php-cgi",
   ".py"  => "/usr/bin/python",
)


Do I have the correct code in the right place or am I missing
something out?


On Jul 20, 7:52 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote:
> On Wed, Jul 20, 2011 at 1:42 PM, Phil <phil...@gmail.com> wrote:
> > if I can get a standard HTML to display on port 80 with lighttpd does
> > that still mean I have to use a different port for fcgi?
>
> absolutely.
>
> the port used between the webserver and webapp must _not_ be the same
> where the browsers connect to the webserver.
>
> --
> Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-20 Thread Phil
if I can get a standard HTML to display on port 80 with lighttpd does
that still mean I have to use a different port for fcgi?

On Jul 18, 10:59 pm, Javier Guerra Giraldez <jav...@guerrag.com>
wrote:
> On Mon, Jul 18, 2011 at 4:55 PM, Phil <phil...@gmail.com> wrote:
> > I did run "./manage.py runfcgi
> > method=threaded host=my ip address port=80"
>
> don't use port 80 for FastCGI.  chances are that it's already used
>
> --
> Javier

-- 
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: get django/lighttpd "hello world" page

2011-07-18 Thread Phil
Thanks for reply. Yeah I seen that, I did run "./manage.py runfcgi
method=threaded host=my ip address port=80" in my mysite directory but
am still getting a "not found" page.


On Jul 18, 10:41 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> Op maandag 18 juli 2011 20:29:03 UTC+1 schreef Phil het volgende:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > I have an ubuntu server, django is fully installed and working,
> > lighttpd is installed and working(works with standard html page), but
> > I am not sure how to get them talking to each other?
>
> > It is my first time putting a django site onto a live server so any
> > help is appreciated. I'm used to a php "stick everything into webroot"
> > setup.
>
> > I have the following in my lighttpd.conf file as mentioned on django
> > website
>
> > server.document-root = "/var/www"
> > fastcgi.server = (
> >     "/mysite.fcgi" => (
> >         "main" => (
> >             # Use host / port instead of socket for TCP fastcgi
> >             "host" => "my ip address",
> >             "port" => 80,
> >             #"socket" => "/home/user/mysite.sock",
> >             "check-local" => "disable",
> >         )
> >     ),
> > )
>
> > At present all that is doing is loading my html page in my webroot. I
> > have restarted lighttpd and all. But not sure how it see's django
> > project?
>
> > Thanks.
>
> See the very good documentation on FastCGI 
> setup:https://docs.djangoproject.com/en/1.3/howto/deployment/fastcgi/
> - it even has a section specifically on lighttpd.
> --
> DR.

-- 
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.



get django/lighttpd "hello world" page

2011-07-18 Thread Phil
Hi,

I have an ubuntu server, django is fully installed and working,
lighttpd is installed and working(works with standard html page), but
I am not sure how to get them talking to each other?

It is my first time putting a django site onto a live server so any
help is appreciated. I'm used to a php "stick everything into webroot"
setup.

I have the following in my lighttpd.conf file as mentioned on django
website

server.document-root = "/var/www"
fastcgi.server = (
"/mysite.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "my ip address",
"port" => 80,
#"socket" => "/home/user/mysite.sock",
"check-local" => "disable",
)
),
)


At present all that is doing is loading my html page in my webroot. I
have restarted lighttpd and all. But not sure how it see's django
project?

Thanks.

-- 
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 on django-admin.py startproject

2011-07-07 Thread Phil
Thanks for advice everyone.

I had installed python2.7 the normal way using "wget
http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2;

I am reading up a bit more on it and will give it another go hopefully
with more success.

Thanks again.


On Jul 4, 10:15 am, Tim Diggins <tim.digg...@gmail.com> wrote:
> I think it helps you to use virtualenv when using django on a machine
> with multiple pythons (it's a great tool anyway, but this is an extra
> reason).
>
> the trick is to use virtualenv's -p argument when creating the
> environment, to specify the path to the python executable.
> so, in summary:
>
> 1) install virtualenv[1] (in any python - whatever one works on the
> command line - maybe by installing the python-virtualenv package on
> your packaging system. Depending on your packaging system, you may
> need to then upgrade it (using pip, which virtualenv automatically
> installs: pip install --upgrade virtualenv)
> 2) create a virtualenv
> virtualenv -p /path/to/python2.7 /some/new/path/for/env
> 3) activate the virtualenv in your shell
> /some/new/path/for/env/bin/activate
> 4) install django using that environment
> (it will pick up the python in the shell - you can also I think use
> pip with a subversion repos[2], but I haven't done that).
> [1]http://pypi.python.org/pypi/virtualenv
> [2]http://www.pip-installer.org/en/latest/requirement-format.html
>
> On Jul 4, 9:26 am, bruno desthuilliers <bruno.desthuilli...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > On Jul 3, 5:46 pm, Phil <phil...@gmail.com> wrote:
>
> > > Thanks for all the comments everyone, it's a great help.
>
> > > Yes I have more than one python installed, when I got the server it
> > > had python2.4 and I read the latest django stopped supporting 2.4 so I
> > > installed python2.7 after reading this(also it said not to delete
> > > python2.4 because 'yum' needs it to survive).
>
> > Yeps, uninstalling your system's Python is usually a *very* bad idea
> > (unless you want a broken system, of course).
>
> > > But I had already
> > > installed django when I just had 2.4. So I reinstalled django after
> > > installing python2.7, but it is still obviously pointing to wrong
> > > python version.
> > > Is it now just a matter of me changing the top line in my 'django-
> > > admin.py' file to point to correct python version, something like?...
>
> > > #! /path/to/python2.7/env python2.7
>
> > > If yes, how do I find correct path to python2.7
>
> > how did you install python 2.7 ?
>
> > Also and FWIW, this has nothing to do with django so this discussion
> > would be better on comp.lang.python
>
> > HTH

-- 
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 on django-admin.py startproject

2011-07-03 Thread Phil
Thanks for all the comments everyone, it's a great help.

Yes I have more than one python installed, when I got the server it
had python2.4 and I read the latest django stopped supporting 2.4 so I
installed python2.7 after reading this(also it said not to delete
python2.4 because 'yum' needs it to survive). But I had already
installed django when I just had 2.4. So I reinstalled django after
installing python2.7, but it is still obviously pointing to wrong
python version.

Is it now just a matter of me changing the top line in my 'django-
admin.py' file to point to correct python version, something like?...

#! /path/to/python2.7/env python2.7

If yes, how do I find correct path to python2.7 because I changed it
to where I have python2.7 and it tells me

"bad interpreter: No such file or directory"

Thanks again.





On Jul 3, 12:18 pm, bruno desthuilliers
<bruno.desthuilli...@gmail.com> wrote:
> On 2 juil, 21:57, Phil <phil...@gmail.com> wrote:
>
> > When I type "import functools" into the python
> > interpreter I get no errors back either. I can't make it out.
>
> see my other answer - either you're not invoking the right Python (if
> you have more than one) or something messes with your sys.path.
> functools was added in Python 2.5, so if you do have a 2.4 version
> installed and django-admin ends up invoking Python 2.4 you're problem
> is almost solved.

-- 
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 on django-admin.py startproject

2011-07-02 Thread Phil
Well I already have subversion installed, that's how I got django in
the first place. When I type "import functools" into the python
interpreter I get no errors back either. I can't make it out.

On Jul 2, 7:31 pm, ravinder singh  wrote:
> @
>   plz try this
>     sudo apt-get install subversion
> than
>       django-admin.py startproject mysite.ok

-- 
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.



error on django-admin.py startproject

2011-07-02 Thread Phil
Hi,

I recently installed the latest development version of Django from
subversion. I followed all steps on site, got no errors. When I type
"import django" in Python interpreter I get no errors.

But when I try run "django-admin.py startproject mysite" I get the
following error...

"ImportError: No module named functools"

Any idea's on what the problem could be?

I am running python2.7 and latest django.

Many thanks.

-- 
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.



Django 1.3 class based generic views queryset

2011-02-09 Thread Phil M
I'm currently having a problem with DetailView based views and
querysets being cached.

If I use a custom manager function for the DetailView queryset, such
as SampleModel.objects.published() below, the first request caches the
queryset and any objects added after are inaccessible - the queryset
gets cached and any new entries result in a 404.

Changing queryset to SampleModel.objects.all() results in no queryset
caching, new objects are immediately visible without having to reload
the webserver.

Is there something I'm missing here?



### models.py:
from django.db import models
import datetime


class SampleModelManager(models.Manager):
def published(self):
return self.get_query_set().filter(published=True,
date__lte=datetime.datetime.now())


class SampleModel(models.Model):
title = models.CharField(max_length=100, db_index=True)
date = models.DateTimeField(default=datetime.datetime.now,
db_index=True)
published = models.BooleanField(default=True, db_index=True)

objects = SampleModelManager()

def __unicode__(self):
return self.title

@models.permalink
def get_absolute_url(self):
return ('sample-model-detail', (), {
'pk': str(self.pk),
})


### urls.py:
from django.conf.urls.defaults import *
import views


urlpatterns = patterns('',
url(r'^(?P\d+)/$',
views.SampleModelDetailView.as_view(),
name='sample-model-detail'),
)


###views.py:
from django.views.generic import DetailView
from models import SampleModel


class SampleModelDetailView(DetailView):
queryset = SampleModel.objects.published()

-- 
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: 32-bit integers IP address to 4-octet IP address

2011-01-23 Thread phil...@bailey.st
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I aledr,

thanks for your reply,


I've added the  socket.inet_ntoa to my  view.py

#view.py
from django.http import HttpResponse
import socket
from snort.models import  Iphdr


def snort(request):

ip = Iphdr.objects.values("ip_src")
return socket.inet_ntoa(ip)


after opening the web page I get this error bac





Request Method: GET
Request URL:http://192.168.1.5:8080/
Django Version: 1.3 beta 1
Exception Type: TypeError
Exception Value:

inet_aton() argument 1 must be string, not ValuesQuerySet

Exception Location: /home/user/django/app/../snort/views.py in snort,
line 10
Python Executable:  /usr/bin/python
Python Version: 2.6.5
Python Path:

['/home/crypto/django/snort',
 '/usr/lib/python2.6',
 '/usr/lib/python2.6/plat-linux2',
 '/usr/lib/python2.6/lib-tk',
 '/usr/lib/python2.6/lib-old',
 '/usr/lib/python2.6/lib-dynload',
 '/usr/lib/python2.6/dist-packages',
 '/usr/lib/pymodules/python2.6',
 '/usr/lib/pymodules/python2.6/gtk-2.0',
 '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode',
 '/usr/local/lib/python2.6/dist-packages']
~


What I'm doing wrong ?

Thanks again,

Phillip



On 01/23/2011 07:18 PM, aledr wrote:
> I guess socket.inet_ntoa is enough for what you need.
> 
> On Sun, Jan 23, 2011 at 7:06 AM, Phillip Bailey <phil...@bailey.st> wrote:
> 
> 
> Dear All,
> 
> I've started playing around with Django in the last few days, and I'm
> enjoying the speed
> and the power of such framework. I'm writing a small application to
> display and sort
> ip addresses stored in a Postgresql database, right now I'm stuck with
> 32-bit integers
> IP address translated to 4-octet IP address .
> 
> Here's the the class of the ip address.
> 
> class Iphdr(models.Model):
>sid = models.IntegerField(primary_key=True)
>cid = models.BigIntegerField(primary_key=True)
>ip_src = models.BigIntegerField()
>ip_dst = models.BigIntegerField()
>ip_ver = models.SmallIntegerField()
>ip_hlen = models.SmallIntegerField()
>ip_tos = models.SmallIntegerField()
>ip_len = models.IntegerField()
>ip_id = models.IntegerField()
>ip_flags = models.SmallIntegerField()
>ip_off = models.IntegerField()
>ip_ttl = models.SmallIntegerField()
>ip_proto = models.SmallIntegerField()
>ip_csum = models.IntegerField()
>class Meta:
>db_table = u'iphdr'
> 
> 
> As the IP addresses are stored in the database as unsigned 32-bit
> integers, so when I
> run  ip = Iphdr.objects.values("ip_src") the result is in 32-bit integers,
> 
> {'ip_src': 3251031814L}{'ip_src': 3251031816L}{'ip_src': 3251031816L}
> {'ip_src': 3251031816L}{'ip_src': 3251031814L}{'ip_src': 3251031816L}
> 
> There's any elegant solution that can translate 32-bit integers to
> 4-octet IP address (192.168.1.88) ?
> 
> Thanks in advance.
> 
> Phillip
>>
- --
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.
>>
>>
> --
> [ ]'s
> Aledr - Alexandre
> "OpenSource Solutions for SmallBusiness Problems"

- -- 
Snorby SSD: The IDS (Intrusion Detection System) Linux distribution
http://bailey.st/blog/snorby-spsa/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJNPK10AAoJENNBJKHbaDgTKN0IAL7YlR/rmtcrj9GDbTCUElu4
81t+0Y8let5XgnvYGVjbaUyPP+BwxhoWpN8f6PqFfohPbj+Xt9EuSdJIV9Wr84Bi
NLhWtQyw/ioFZaDH1b50smEfR1qqIsQRd+wfbor21cwe5YhjorZ9FuPoH1HBFFPp
4kct+b0vMuGb0OjlWRosVAe/p3mzbNbn8glVhqaBthAl6GmAOrBuEmRqdB6jgN2s
/fLNGKi08YdlbHn5hvnmXTONiFQf5aA40ZpKlTmCWHJUiVINfuUw7FE5E/ZuYve2
l7Vs2BIIKy3X4oRFZbeQXV/yVyOKygIwdmzJZ+iBLL4zdST8YA3Zj/8Q73pX434=
=6lwe
-END PGP SIGNATURE-

-- 
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: Setup issue

2011-01-16 Thread Phil
Thanks for reply Mike and TheRedRabbit, unfortunately I have never got
to try your suggestions. Before your response came in I tried
upgrading Lucid Lynx to Maverick Meerkat and lets just say it didn't
go well for me, I no longer have Linux installed on my laptop so am
back in Windows :(

to be continued



On Jan 6, 3:51 am, Mike Ramirez  wrote:
> > on linux you have to type:
>
> > 'python django-admin.py startproject projectname'
>
> > I think your missing the python let me know if this sorts it out
>
> Forgot to add the executable bit must be set in the permissions i.e.:
> chmod a+x django-admin.py  (though this is already done for you by the
> django team as it comes out of svn/tarballs with it set.)

-- 
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: Setup issue

2011-01-04 Thread Phil
Hi Shawn,

When it wasn't working I tried both from command line and from
interpreter, from command line just says "command not found". No I
wasn't calling the project that, I've tried a few different project
names and none seem to work.

Thanks for advice/ tips. I'll keep posted when I get to the bottom of
it.



On Jan 4, 3:33 pm, Shawn Milochik  wrote:
> What actual project name are you using? Have you tried using different 
> project names?
>
> If you're literally using "projectname" then you may be using a command-line 
> argument and causing a conflict.
>
> Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Setup issue

2011-01-04 Thread Phil
Hi all,

I am having a setup issue on my personal laptop, I got through setup
and couple of tutorials on my Mac in work but not having any joy at
home. I'm running Ubuntu 10.04 Lucid Lynx.

I run "import django" and I don't get any errors back so I thought I
was OK, but when I run "django-admin.py startproject projectname" I
get back an error saying...

"File ", line 1django-admin.py startproject
projectname..Error: invalid syntax"


I'm running on python 2.6.5, I had python3 installed and got rid of it
encase it was conflicting, basically my question is were do I need to
start looking, I must be missing something but I'm not sure were to
start. Any advice I could get would be magic as it's my new year
resolution to be efficient django man by end of year, not off to a
great start :(

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Unit test failing when testing post of a comment

2010-11-14 Thread Phil Gyford
Answering myself, in case this is useful to anyone in the future...

I eventually discovered the problem lay in the method which checked
submitted comments for spam (a method along these lines:
http://sciyoshi.com/blog/2008/aug/27/using-akismet-djangos-new-comments-framework/
). It expected the request object to have META['HTTP_REFERER'] and
META['HTTP_USER_AGENT']. When the comment was submitted from a unit
test, these weren't present and this was causing things to fall over.

I've no idea why that generated what looked like a template error, but
checking for the presence of these, and using empty strings if they're
not present, has got things working again.


On Thu, Nov 11, 2010 at 5:30 PM, Phil Gyford <gyf...@gmail.com> wrote:
> Hi,
>
> I have a unit test that tests that a comment can be posted on an entry
> in a Django blog. Posting a comment myself in the browser works fine,
> but the test always fails with this error:
>
> "TemplateSyntaxError: Caught VariableDoesNotExist while rendering:
> Failed lookup for key [request] in u'[{}]'"
>
> Which suggests the use of the 'request' variable in a template isn't
> working. I guess it's a ContextProcessor problem, but I'm stuck as to
> why it fails in the test. Here's the test:
>
> 
> from django.test.client import Client
> from django.test import TestCase
> import datetime, time
> from weblog.models import Entry
> from django.contrib.comments.forms import CommentSecurityForm
>
> class WeblogBaseTestCase(TestCase):
>    fixtures = ['../../aggregator/fixtures/test_data.json', ]
>
> class CommentTestCase(WeblogBaseTestCase):
>
>    def post_comment(self, entry_id=1):
>        form = CommentSecurityForm( Entry.live.get(pk=entry_id) )
>        timestamp = int(time.time())
>        security_hash = form.initial_security_hash(timestamp)
>        c = Client()
>        response = c.post('/cmnt/post/', {
>                                'name': 'Bobby',
>                                'email': 'bo...@example.com',
>                                'url': '',
>                                'comment': 'Hello',
>                                'content_type': 'weblog.entry',
>                                'timestamp': timestamp,
>                                'object_pk': entry_id,
>                                'security_hash': security_hash,
>                            },follow=True)
>
>        self.failUnlessEqual(response.status_code, 200)
> 
>
> I'm stumped as to why this error is generated in the test, but not on
> the site, and I'm not sure how to poke around to see where it's going
> wrong. Any thoughts?
>
> Thanks.
>
> --
> http://www.gyford.com/
>



-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Unit test failing when testing post of a comment

2010-11-11 Thread Phil Gyford
Hi,

I have a unit test that tests that a comment can be posted on an entry
in a Django blog. Posting a comment myself in the browser works fine,
but the test always fails with this error:

"TemplateSyntaxError: Caught VariableDoesNotExist while rendering:
Failed lookup for key [request] in u'[{}]'"

Which suggests the use of the 'request' variable in a template isn't
working. I guess it's a ContextProcessor problem, but I'm stuck as to
why it fails in the test. Here's the test:


from django.test.client import Client
from django.test import TestCase
import datetime, time
from weblog.models import Entry
from django.contrib.comments.forms import CommentSecurityForm

class WeblogBaseTestCase(TestCase):
fixtures = ['../../aggregator/fixtures/test_data.json', ]

class CommentTestCase(WeblogBaseTestCase):

def post_comment(self, entry_id=1):
form = CommentSecurityForm( Entry.live.get(pk=entry_id) )
timestamp = int(time.time())
security_hash = form.initial_security_hash(timestamp)
c = Client()
response = c.post('/cmnt/post/', {
'name': 'Bobby',
'email': 'bo...@example.com',
'url': '',
'comment': 'Hello',
'content_type': 'weblog.entry',
'timestamp': timestamp,
'object_pk': entry_id,
'security_hash': security_hash,
},follow=True)

self.failUnlessEqual(response.status_code, 200)


I'm stumped as to why this error is generated in the test, but not on
the site, and I'm not sure how to poke around to see where it's going
wrong. Any thoughts?

Thanks.

-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: What does an ideal django workflow setup look like?

2010-10-22 Thread Phil Gyford
After reading a few articles on this kind of thing, I tried to figure
out a good, repeatable way to do some of this, and wrote up the whole
process here: 
http://www.gyford.com/phil/writing/2010/09/29/django-environment.php

It doesn't (yet) cover the best ways of integrating dev/production
servers. I'm only really getting started myself, so would welcome any
further suggestions for improvement.

Phil


On Fri, Oct 22, 2010 at 4:02 PM, Ken <ken.kyhu...@gmail.com> wrote:
> *I've Googled, but have not found any really organized and layman-
> friendly overview, which is why I came here*
>
> I know how to get python/django working on my computer (PC or Mac) and
> have developed simple test apps using django's built-in dev server and
> a mysql back-end. So I can get things to work and don't need help on
> installing stuff.
>
> But as a coding hobbyist, I don't know how to set up a pro workflow. I
> don't know best practices on how to setup and maintain a dev and
> production environment, how to efficiently publish to production, how
> to integrate all that into a version control system (i.e., git),
> basically anything that a pro coder at a startup would take for
> granted as "the way to do things".
>
> I understand there are many different ways and products to use to
> setup a great workflow for developing in django, but would like to
> hear how you or your startup team (or corporate dev group) does it.
> Specifics would be amazing, as I need a little hand holding, i.e.
> please cover anything and everything that I should know in order to
> develop efficiently, robustly, and eventually collaboratively.
>
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: trouble creating first project

2010-10-12 Thread Phil
Thanks for reply Steve.

Yes I seen the section about symbolic linking on the django website.
It says on the website to type this command

"ln -s WORKING-DIR/django-trunk/django/bin/django-admin.py /usr/local/
bin"

which I did(replacing WORKING_DIR obviously with the right path), but
I'm not sure what "/usr/local/bin" is supposed to point to or what
path should this be exactly?


On Oct 11, 6:20 pm, Steve Holden <holden...@gmail.com> wrote:
> On 10/11/2010 1:47 AM, Phil wrote:> Hi,
>
> > I am having trouble creating my first project. I am running the latest
> > version of Ubuntu and I installed Django from svn, when I run 'import
> > django' i get no errors back so I assume its installed OK.
>
> > When I run 'django-admin.py startproject myproject' I get back an
> > error saying 'django-admin.py: command not found'.
>
> > How can I solve/get around this error? Appreciate any help/ advice
> > offered
>
> When you install Django from svn it doesn't add django-admin to any of
> the directories that your system looks for programs in (i.e. those
> directories on your path).
>
> When you install Django with setuptools (i.e. using setup.py) then you
> should find that django-admin is placed where it can be found.
>
> The simplest way around this is to make a symbolic link from one of the
> directories on your path to the django-admin.py file.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



trouble creating first project

2010-10-10 Thread Phil
Hi,

I am having trouble creating my first project. I am running the latest
version of Ubuntu and I installed Django from svn, when I run 'import
django' i get no errors back so I assume its installed OK.

When I run 'django-admin.py startproject myproject' I get back an
error saying 'django-admin.py: command not found'.

How can I solve/get around this error? Appreciate any help/ advice
offered

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Customising comment framework and keeping moderation working

2010-10-06 Thread Phil Gyford
Thanks Klaas. That second one does seem related to my problem although
after a couple of days struggling with this issue I'm now at the
limits of my knowledge and don't know if it actually helps me :)

I found what seems like a related ticket that's been opened and closed
a couple of times and tentatively re-opened it with an explanation:
http://code.djangoproject.com/ticket/12812

I'm going to have to move on though and try and work around the
problem for now as this frustration is doing me no good at all :(

Phil


On Wed, Oct 6, 2010 at 9:06 AM, Klaas van Schelven
<klaasvanschel...@gmail.com> wrote:
> Phil,
>
> A quick reply so I may be wrong on the details.
> I think you're running into a limitation on the standard way of doing
> things in Django.
>
> I've talked about this before here:
> http://groups.google.com/group/django-users/browse_thread/thread/22875fd287d0aa81/d6cf04a857424678?show_docid=d6cf04a857424678
>
> and here:
> http://groups.google.com/group/django-developers/browse_thread/thread/363fc7f3ca107f94/25a85be6cce875ed?hide_quotes=no
>
> no time for a full reply here but if it's gotten personal this might
> help you a bit,
>
> Klaas
>
> On Oct 5, 4:36 pm, Phil Gyford <gyf...@gmail.com> wrote:
>> I've made as minimal a complete demonstration of this as possible, to
>> try and work out where I'm going 
>> wrong:http://github.com/philgyford/django-commentstest/
>>
>> It works fine: comments can successfully be disabled on a per-Entry
>> basis. But, if you add "from weblog.models import Entry" to either
>> customcomments/forms.py or customcomments/models.py then comments are
>> *always* allowed through. Any idea why? Thanks.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Oct 5, 2010 at 2:46 PM, Phil Gyford <gyf...@gmail.com> wrote:
>> > I've investigated further and... it's very strange.
>>
>> > I've got a version of my custom comments framework, with
>> > enable_comments moderation, working fine. Here are the contents of my
>> > working customcomments/forms.py and customcomments/models.py:
>> >http://dpaste.com/253382/
>>
>> > However, if I add "from weblog.models import Blog" to either of those
>> > files, my custom moderation has no effect.
>>
>> > This is a problem, because what I really want to do is not add a
>> > 'title' field to each custom comment, but add a ForeignKey field that
>> > links to the Blog object (comments are posted on Entries, each of
>> > which is associated with a Blog). So I will need to import the Blog
>> > class.
>>
>> > In case it helps, here's the contents of weblog/models.py that
>> > contains the Blog class:http://dpaste.com/253384/
>>
>> > This modification really isn't worth the two days I've now spent
>> > puzzling over it, but it's got personal, and I just want to understand
>> > the solution now! Any help very much appreciated.
>>
>> > On Tue, Oct 5, 2010 at 11:27 AM, Phil Gyford <gyf...@gmail.com> wrote:
>> >> Hi,
>>
>> >> I can't get my extended version of django.contrib.comments to take
>> >> notice of moderation.
>>
>> >> If I use the standard comments framework, then my subclass of
>> >> CommentModerator does the job - I've just used it to define
>> >> enable_field, and this allows or prohibits comments as expected.
>>
>> >> But if I switch to using my custom version of the comments framework
>> >> (which adds an extra field) it seems like the moderator is ignored -
>> >> all comments are allowed through, no matter whether the enable_field
>> >> on the commented-on object is true or false.
>>
>> >> I can't see what I'm missing. Here's the code for my moderator, in
>> >> case it helps:http://dpaste.com/253308/It works fine like that, with
>> >> the standard framework, but if I switch the import lines over, add my
>> >> custom comments app to INSTALLED_APPS and COMMENTS_APP settings, the
>> >> enable_field has no effect.
>>
>> >> What's the magical missing step? Thanks.
>>
>> >> Phil
>>
>> >> --
>> >>http://www.gyford.com/
>>
>> > --
>> >http://www.gyford.com/
>>
>> --http://www.gyford.com/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Customising comment framework and keeping moderation working

2010-10-05 Thread Phil Gyford
I've made as minimal a complete demonstration of this as possible, to
try and work out where I'm going wrong:
http://github.com/philgyford/django-commentstest/

It works fine: comments can successfully be disabled on a per-Entry
basis. But, if you add "from weblog.models import Entry" to either
customcomments/forms.py or customcomments/models.py then comments are
*always* allowed through. Any idea why? Thanks.


On Tue, Oct 5, 2010 at 2:46 PM, Phil Gyford <gyf...@gmail.com> wrote:
> I've investigated further and... it's very strange.
>
> I've got a version of my custom comments framework, with
> enable_comments moderation, working fine. Here are the contents of my
> working customcomments/forms.py and customcomments/models.py:
> http://dpaste.com/253382/
>
> However, if I add "from weblog.models import Blog" to either of those
> files, my custom moderation has no effect.
>
> This is a problem, because what I really want to do is not add a
> 'title' field to each custom comment, but add a ForeignKey field that
> links to the Blog object (comments are posted on Entries, each of
> which is associated with a Blog). So I will need to import the Blog
> class.
>
> In case it helps, here's the contents of weblog/models.py that
> contains the Blog class: http://dpaste.com/253384/
>
> This modification really isn't worth the two days I've now spent
> puzzling over it, but it's got personal, and I just want to understand
> the solution now! Any help very much appreciated.
>
>
> On Tue, Oct 5, 2010 at 11:27 AM, Phil Gyford <gyf...@gmail.com> wrote:
>> Hi,
>>
>> I can't get my extended version of django.contrib.comments to take
>> notice of moderation.
>>
>> If I use the standard comments framework, then my subclass of
>> CommentModerator does the job - I've just used it to define
>> enable_field, and this allows or prohibits comments as expected.
>>
>> But if I switch to using my custom version of the comments framework
>> (which adds an extra field) it seems like the moderator is ignored -
>> all comments are allowed through, no matter whether the enable_field
>> on the commented-on object is true or false.
>>
>> I can't see what I'm missing. Here's the code for my moderator, in
>> case it helps: http://dpaste.com/253308/ It works fine like that, with
>> the standard framework, but if I switch the import lines over, add my
>> custom comments app to INSTALLED_APPS and COMMENTS_APP settings, the
>> enable_field has no effect.
>>
>> What's the magical missing step? Thanks.
>>
>> Phil
>>
>> --
>> http://www.gyford.com/
>>
>
>
>
> --
> http://www.gyford.com/
>



-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Customising comment framework and keeping moderation working

2010-10-05 Thread Phil Gyford
I've investigated further and... it's very strange.

I've got a version of my custom comments framework, with
enable_comments moderation, working fine. Here are the contents of my
working customcomments/forms.py and customcomments/models.py:
http://dpaste.com/253382/

However, if I add "from weblog.models import Blog" to either of those
files, my custom moderation has no effect.

This is a problem, because what I really want to do is not add a
'title' field to each custom comment, but add a ForeignKey field that
links to the Blog object (comments are posted on Entries, each of
which is associated with a Blog). So I will need to import the Blog
class.

In case it helps, here's the contents of weblog/models.py that
contains the Blog class: http://dpaste.com/253384/

This modification really isn't worth the two days I've now spent
puzzling over it, but it's got personal, and I just want to understand
the solution now! Any help very much appreciated.


On Tue, Oct 5, 2010 at 11:27 AM, Phil Gyford <gyf...@gmail.com> wrote:
> Hi,
>
> I can't get my extended version of django.contrib.comments to take
> notice of moderation.
>
> If I use the standard comments framework, then my subclass of
> CommentModerator does the job - I've just used it to define
> enable_field, and this allows or prohibits comments as expected.
>
> But if I switch to using my custom version of the comments framework
> (which adds an extra field) it seems like the moderator is ignored -
> all comments are allowed through, no matter whether the enable_field
> on the commented-on object is true or false.
>
> I can't see what I'm missing. Here's the code for my moderator, in
> case it helps: http://dpaste.com/253308/ It works fine like that, with
> the standard framework, but if I switch the import lines over, add my
> custom comments app to INSTALLED_APPS and COMMENTS_APP settings, the
> enable_field has no effect.
>
> What's the magical missing step? Thanks.
>
> Phil
>
> --
> http://www.gyford.com/
>



-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Customising comment framework and keeping moderation working

2010-10-05 Thread Phil Gyford
Hi,

I can't get my extended version of django.contrib.comments to take
notice of moderation.

If I use the standard comments framework, then my subclass of
CommentModerator does the job - I've just used it to define
enable_field, and this allows or prohibits comments as expected.

But if I switch to using my custom version of the comments framework
(which adds an extra field) it seems like the moderator is ignored -
all comments are allowed through, no matter whether the enable_field
on the commented-on object is true or false.

I can't see what I'm missing. Here's the code for my moderator, in
case it helps: http://dpaste.com/253308/ It works fine like that, with
the standard framework, but if I switch the import lines over, add my
custom comments app to INSTALLED_APPS and COMMENTS_APP settings, the
enable_field has no effect.

What's the magical missing step? Thanks.

Phil

-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 configuring Django to run customized comments framework

2010-10-02 Thread Phil Gyford
A bit late, so you may have solved this or given up on it, but
still... I just had the same error message and eventually solved it by
changing the order of my INSTALLED_APPS. So maybe you have slightly
different settings on your local and live servers, and the apps are
ordered differently on each?

For example if I did this:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.comments',
'django.contrib.admin',
'django.contrib.markup',
'django.contrib.flatpages',
'taggit',
'myproject.weblog',
'myproject.aggregator',
'myproject.comments', # My custom comment app
)

then I got the error. But if I did this:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.comments',
'django.contrib.admin',
'django.contrib.markup',
'django.contrib.flatpages',
'taggit',
'myproject.comments', # My custom comment app
'myproject.weblog',
'myproject.aggregator',
)

(ie, move 'myproject.comments', my custom comments app, further up)
then it worked fine. It just seems to need to be above
'myproject.weblog', so maybe it's some dependency in my code I don't
fully understand. Anyway, hope that helps.


On Thu, Aug 26, 2010 at 1:54 PM, Groady  wrote:
> I'm having an issue with setting up a Django website which uses the
> Django comments framework on my server. The site runs fine when run
> locally (using manage.py runserver) but when pushed live I'm getting
> the error:
>
> ImproperlyConfigured at /
> The COMMENTS_APP setting refers to a non-existing package.
>
> My server is an apache/mod_wsgi setup. My site contains 2 applications
> called weblog and weblog_comments. I've appended my site's path and
> it's parent directories to my django.wsgi file as per the guide
> located here: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
> I can comment out the COMMENTS_APP line from my settings.py and the
> site runs fine so I know site is on the python path correctly.
>
> My custom comment model is called WeblogComment and extends the
> default Comment model. It only extends this to add methods to the
> model, it doesn't change Comment model fields thus It has proxy=True
> in it's Meta class.
>
> Any advice would be great.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
http://www.gyford.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Multiple URLs, Common View

2010-07-22 Thread Phil Edwards
On 20/07/10 13:01, joconnell wrote:
> Hi,
> 
> If you use something like
> 
> r'^(?P.+)/$'
> 
> then a variable called page will get passed to your view. It will
> contain the string that has been matched against the specified pattern
> (in this case any character 1 or more times (.+))
> 

Thanks John and everyone else who replied - the regex above did the
trick for me. I've now got the whole site running from just a single
view called servePage, and I don;t have to update my URL list each time
I add a new page to the database, which was exactly what I wanted.

Thanks again folks!


-- 

Regards

Phil Edwards   |  PGP/GnuPG Key Id
Brighton, UK   |  0xDEF32500

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Multiple URLs, Common View

2010-07-18 Thread Phil Edwards

On 18/07/2010 23:55, Phil Edwards wrote:


-begin-
def servePage(request):
if request.path[1:] == '':
thisPage = Page.objects.get(name = unicode('home'))
else:
thisPage = Page.objects.get(name = unicode(request.path[1:]))
sidebar_list = Page.objects.filter(category = thisPage.category)
article_list = Article.objects.filter(page =
thisPage.id).order_by('-amendedon')
return render_to_response('base.html', locals())
--end--



Meh. Don't know what happened to the indentation there, but it should 
look like this:


-begin-
def servePage(request):
if request.path[1:] == '':
thisPage = Page.objects.get(name = unicode('home'))
else:
thisPage = Page.objects.get(name = unicode(request.path[1:]))
sidebar_list = Page.objects.filter(category = thisPage.category)
article_list = Article.objects.filter(page = 
thisPage.id).order_by('-amendedon')

return render_to_response('base.html', locals())
--end--

--

Regards

Phil Edwards   |  PGP/GnuPG Key Id
Brighton, UK   |  0xDEF32500

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.



Multiple URLs, Common View

2010-07-18 Thread Phil Edwards

Hi All:

I've written myself an ultra-simple CMS as a Django learning exercise. 
It consists of a couple of simple models and a single template to serve 
up articles which have previously been posted into the database from the 
admin interface.


Everything seems to work okay, but I think my implementation could be 
better. I have a single view function which at present looks like this:


-begin-
def servePage(request):
if request.path[1:] == '':
thisPage = Page.objects.get(name = unicode('home'))
else:
thisPage = Page.objects.get(name = unicode(request.path[1:]))
sidebar_list = Page.objects.filter(category = thisPage.category)
article_list = Article.objects.filter(page = 
thisPage.id).order_by('-amendedon')

return render_to_response('base.html', locals())
--end--

Firstly, I suspect that my use of request.path[:1] to get the URL being 
accessed is not the accepted Django way. Is there a better method?


Secondly, even with the generic view that I'm using, I still need to 
have multiple entries in my urls.py file in order to make pages work, i.e:


urlpatterns = patterns('',
(r'^admin/(.*)', admin.site.root),
('^$', servePage),
(r'^home$', servePage),
(r'^about$', servePage),
(r'^family$', servePage),
(r'^aviation$', servePage),
(r'^linux$', servePage),
(r'^windows$', servePage),
(r'^coding$', servePage),
(r'^photo$', servePage),
(r'^gallery$', servePage),
(r'^ppl-diary$', servePage),
)

Is there a way to replace this with a catch all pattern which does not 
break other things? I've tried patterns such as r'^' and this simply 
leads to my static content being skipped, so I see the pages, but with 
no stylesheet applied and all images missing.


I'm seeing a tantalizing clue from the 404 page that gets generated when 
I have DEBUG = True in my settings file. When Django tells me what URL 
patterns it tried, the very last one is "^static/(?P.*)$" - I 
suspect that if I knew how to incorporate that into my urls.py ahead of 
my 'catchall' pattern, I'd be good to go...


I've Googled for terms like 'django generic view' and 'django multiple 
url single view' but I can't find anything useful. I think that at this 
level, my setup probably doesn;t matter, but if it does I'm using Django 
1.2 on both Windows XP and Linux, with Python 2.7 and 2.6 respectively, 
depending upon which machine I have my USB stick plugged into at the time.


--

Regards

Phil Edwards   |  PGP/GnuPG Key Id
Brighton, UK   |  0xDEF32500

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.



  1   2   3   >