Re: Reverse for 'resetPasswordSendMail' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'$resetPasswordSendMail/$']

2016-07-11 Thread James Schneider
>
> urls.py
>
> from django.conf.urls import url, include
> from django.contrib import admin
> from account import views
> from django.core.urlresolvers import reverse
>
> app_name = 'account'
>
> urlpatterns = [
> #url(r'^admin/', admin.site.urls),
> url(r'^$', views.login, name='login' ),
> url(r'^login/$', views.login, name='login'),
> url(r'^forgotPassword/$', views.forgotPassword,
name='forgotPassword'),
> url(r'^resetPasswordSendMail/$', views.resetPasswordSendMail,
name='resetPasswordSendMail'),
> ]
>

You have two URL's named 'login', that will cause problems later if it
isn't already.

Is this your root urls.py file (in the same directory as your settings.py
file)? I'm not sure you can set an app_name in that file. I believe that is
designated for use within an app urls.py (appname/urls.py) that is read as
part of include() from the root urls.py. I'm not in front of a computer to
check, so I don't know if that's the case, and I may be incorrect.

-James

-- 
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/CA%2Be%2BciWqnN%3DqxCdfpcQBgCL8zcj0Trnimit93wpzf03d7zY0iQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - File or Image Delete

2016-07-11 Thread Mstislav Kazakov
Try to override `delete` method in your model. You should do something like
this:

class Example(models.Model):
f = models.FileField(null=True, blank =True)


def delete(self,*args,**kwargs):
if os.path.isfile(self.f.path):
os.remove(self.f.path)

super(Example, self).delete(*args,**kwargs)


2016-07-09 21:04 GMT+05:00 :

> This way the Image is removed from database, not from the server.
>
> On Friday, July 8, 2016 at 6:41:57 PM UTC+3, Mstislav Kazakov wrote:
>>
>> Just pass empty value in file field.
>> If blank=True and null=True, everything should work fine and image will
>> be removed.
>>
>> пятница, 8 июля 2016 г., 17:23:42 UTC+5 пользователь sevenr...@gmail.com
>> написал:
>>>
>>> The user has the possibility to add/delete image and documents.
>>>
>>>
>>> I used GCBV UpdateView and a FormModel for this.
>>>
>>>
>>> How can I offer the possibility to the user to delete the file/image ?
>>>
>> --
> 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/bdd2edd2-d232-416e-9ff4-b5b3519e6c1e%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAP8J_KZQrXuvmaqVyGomh-OjeJotKQasWJf5%3D%3Dqx8sGDZgadmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Class-based Views with Multiple Forms

2016-07-11 Thread Paul
By default Django’s class-based views support just a single form per view. 

I need more forms per view because I want to combine a ForeignKey relations 
with various ModelForm instances and also to appear in the FormModel.

In Django documentation and other tutorials I found formsets, but in the 
default examples you repeat the same form multiple times, which is not what 
I need.

Inline formsets looks like what I need , but I didn't found an example for 
GBV like CreateView. Can you give me some examples, link to a tutorial ?

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0cd0a748-1d47-4750-b566-1e8451d8b530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - File or Image Delete

2016-07-11 Thread Paul
thanks

On Monday, July 11, 2016 at 11:16:27 AM UTC+3, Mstislav Kazakov wrote:
>
> Try to override `delete` method in your model. You should do something 
> like this:
>
> class Example(models.Model):
> f = models.FileField(null=True, blank =True)   
>
>
> def delete(self,*args,**kwargs):
> if os.path.isfile(self.f.path):
> os.remove(self.f.path)
>
> super(Example, self).delete(*args,**kwargs)
>
>
> 2016-07-09 21:04 GMT+05:00 >:
>
>> This way the Image is removed from database, not from the server.
>>
>> On Friday, July 8, 2016 at 6:41:57 PM UTC+3, Mstislav Kazakov wrote:
>>>
>>> Just pass empty value in file field.
>>> If blank=True and null=True, everything should work fine and image will 
>>> be removed.
>>>
>>> пятница, 8 июля 2016 г., 17:23:42 UTC+5 пользователь sevenr...@gmail.com 
>>> написал:

 The user has the possibility to add/delete image and documents.


 I used GCBV UpdateView and a FormModel for this. 


 How can I offer the possibility to the user to delete the file/image ?

>>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/bdd2edd2-d232-416e-9ff4-b5b3519e6c1e%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/c672d36c-8c89-4b7c-94e2-64e7da28d014%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: dynamic WAV file??

2016-07-11 Thread ludovic coues
My go to solution for that king of problem is to append a query
argument. If the browser have a cached version of sound.wav?v=1 but
you serve sound.wav?v=2, the browser should grab the last version,
even if the file is still named sound.wav.

For your second point, you could use BytesIO, from the io modules in
the standard library. It give you a file like object, you work on it
like you would with a real file then you craft your response with
getvalue and by settings the appropriate headers.

2016-07-10 23:56 GMT+02:00 Joe Gredder :
> Im writing to a WAV file using Python script and trying to play it using
> HTML  tag from Static dir...
>
> The Process:
>
> Parameters from website are written to .txt in views --> Python file exc.
> with subprocess.call and .txt parameters read --> WAV (sound.wav) written to
> with Python and saved in Static --> WAV referenced using Static ---> WAV
> played with button.click using HTML 
>
> Problems:
>
> 1.  HTML is caching the file and not playing updated WAV (b/c same name).
> How can I create new file names and send to Python script through views?
>
> 2.  What would be the best way to deliver and play a new WAV file to the
> Template without static?
>
> Thanks,
>
> Joseph Kerr
>
> --
> 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/43292bf1-58bd-4508-b941-9872df21d1b0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTYnjROC5ukgV7PYRE3aJSmA1BFTp-5zA9Mt_fAvqVdopw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Class-based Views with Multiple Forms

2016-07-11 Thread Edgar Gabaldi
Hi paul. There is a package called django-extra-views that solve exactly
this problem.

See CreateViewWithInlines (or something like that).

Em 7h40 Seg, 11/07/2016, Paul  escreveu:

> By default Django’s class-based views support just a single form per view.
>
> I need more forms per view because I want to combine a ForeignKey
> relations with various ModelForm instances and also to appear in the
> FormModel.
>
> In Django documentation and other tutorials I found formsets, but in the
> default examples you repeat the same form multiple times, which is not what
> I need.
>
> Inline formsets looks like what I need , but I didn't found an example for
> GBV like CreateView. Can you give me some examples, link to a tutorial ?
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0cd0a748-1d47-4750-b566-1e8451d8b530%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGjPPHkW_71OnkomphxAZV9qSAHeh84O_fd7G3YmB7kcpNPyKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django data insertion into database

2016-07-11 Thread Derek
Looks like the lines in your code, from # forms onwards need to be 
outdented (so the "class" statements are at matching levels).

On Monday, 11 July 2016 08:34:44 UTC+2, Ikram Ulhaq wrote:
>
> hi everyone!
> i am new in django web development.i want to insert data into my database 
> using following code but i got error like this.
>model = Incident
> NameError: name 'Incident' is not defined
>
> please help.
>
>
>
>
> my code is below
> class Incident(models.Model):
> subject = models.CharField(max_length=256)
> severity = models.IntegerField(choices=SEVERITY)
> status = models.CharField(max_length=20, choices=STATUS, 
> default=_("Open"))
> detection = models.IntegerField(choices=DETECTION, default='1')
> plan = models.IntegerField(choices=PLAN, default='1')
> confidentiality = models.IntegerField(choices=CONFIDENTIALITY, 
> default='1')
> date = models.DateTimeField(default=datetime.datetime.now, blank=True)
> is_starred = models.BooleanField(default=False)
> description = models.TextField()
> def get_absolute_url(self):
> return receiver('incident:detail',kwargs={'pk':self.pk})
>
> def __unicode__(self):
> return self.subject
>
>
> # forms ===
>
>
> class IncidentForm(ModelForm):
>
> def __init__(self, *args, **kwargs):
> super(ModelForm, self).__init__(*args, **kwargs)
> self.fields['subject'].error_messages['required'] = 'This field 
> is required.'
> self.fields['category'].error_messages['required'] = 'This field 
> is required.'
> 
> self.fields['concerned_business_lines'].error_messages['required'] = 'This 
> field is required.'
> self.fields['detection'].error_messages['required'] = 'This field 
> is required.'
>
> self.fields['severity'].error_messages['required'] = 'This field 
> is required.'
> self.fields['is_major'].error_messages['required'] = 'This field 
> is required.'
>
> self.fields['is_major'].label = 'Major?'
>
> class Meta:
>   model = Incident
>
>

-- 
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/825414fe-35d0-4084-abef-934a5195cd0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


inlineformset_factory Tutorial

2016-07-11 Thread Paul
I'm searching for a good tutrial regarding "inlineformset_factory". the 
information about it od Django site is very scarce.

-- 
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/dbf621bb-5a5f-47cd-b4e9-0112439a24b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slow Django dev server reload

2016-07-11 Thread ludovic coues
Any chance the big time difference come from the difference between
SSD and mechanical drive ?

2016-07-11 7:00 GMT+02:00 Krishna Bharadwaj :
> Fred,
>
> That's very good to know. At least it tells me that the number of imports
> could be one of the main reasons for the slow down. And I apologise for the
> delay in responding. I am not certain why the number is so high in my case.
> I will take a closer look at it and share what I find out later. I would
> like to thank you again for offering some insights and a reference so that I
> could work on improving my codebase.
>
> On Wednesday, 6 July 2016 04:22:29 UTC+5:30, Fred Stluka wrote:
>>
>> Krishna,
>>
>> Only a third of your count -- 551
>>
>> % tcsh
>>   % python -v manage.py runserver >&! ~/1.1
>>   % grep -E "^import" ~/1.1 | wc -l
>>  551
>>
>> So, you didn't see any noticeable pauses as the -v output was
>> streaming to the terminal window?  Sounds like it's just doing a
>> lot of work, not stalling out anywhere in particular.
>>
>> Why so many imports?  Seems odd that I have more models,
>> but fewer lines of code, and far fewer imports.  Are all of your
>> imports still needed?  Or are many of them obsolete and could
>> be deleted?  We tend to get rid of our dead ones pretty quickly
>> because PyCharm shows them as grey when they're not needed.
>>
>> --Fred
>> 
>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> 
>>
>> On 7/5/16 2:00 PM, Krishna Bharadwaj wrote:
>>
>> Hi Fred,
>>
>> Thanks for providing your project as a reference and also the python
>> verbose tip. I just started my dev server with the -v option to see how many
>> import statements are fired. grep '^import ' returned about 1500 lines in
>> the output (about 75 models with about 40k lines of code). I could not
>> narrow down the problem to any specific import / module. Curious to know how
>> many imports were fired in your case?
>>
>> On Tuesday, 5 July 2016 01:50:26 UTC+5:30, Fred Stluka wrote:
>>>
>>> Krishna,
>>>
>>> I'm using:
>>> - Mac OSX 10.11.5 (El Capitan)
>>> - 2.3GHz Intel Core i7
>>> - 16 GB 1333 MHz DDR3
>>> - 512GB SSD
>>> - Python 2.7.3
>>> - Django 1.4.2
>>> - MySQL 5.1.33
>>>
>>> And it takes less than a second from when I type:
>>> % python manage.py runserver
>>> until I see:
>>>
>>> Validating models...
>>>
>>> 0 errors found
>>> Django version 1.4.2, using settings 'hhl.settings'
>>> Development server is running at http://127.0.0.1:8000/
>>> Quit the server with CONTROL-C.
>>>
>>>
>>> I have about 40 models.py files, of which 25 are empty and
>>> exist only to prevent warnings when run automated tests.
>>> The other 15 contain about 100 Django models with a total
>>> of about 27,000 lines of code.
>>>
>>> The 100 models all get validated against a locally running
>>> MySQL server.
>>>
>>> So, it should NOT be that slow on your Mac.
>>>
>>> To narrow down the problem, I suggest you use the -v option:
>>> % python -v manage.py runserver
>>> and watch to see what seems to be taking so long.
>>>
>>> Any other suggestions, anyone?
>>>
>>> --Fred
>>> 
>>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>>> Open Source: Without walls and fences, we need no Windows or Gates.
>>> 
>>>
>>> On 7/4/16 2:20 AM, Krishna Bharadwaj wrote:
>>>
>>> Hi Fred,
>>>
>>> It takes about 3.5 - 5 seconds on my machine (Mac OSX - 2.6 GHz Intel
>>> Core i5, 8 GB 1600 MHz DDR3 and SSDs). I was curious to know if I was doing
>>> something wrong. Any pointers regarding this will be very helpful.
>>>
>>> On Sunday, 3 July 2016 20:47:50 UTC+5:30, Fred Stluka wrote:

 Krishna,

 How long is "a long time"?  I have a project of ~200K lines of
 python/django code.  The dev server reloads in a second or so.

 --Fred
 
 Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
 Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
 Open Source: Without walls and fences, we need no Windows or Gates.
 

 On 7/3/16 8:42 AM, Krishna Bharadwaj wrote:

 Hi everyone,

 I am working on a project which is substantially big (~40k lines of
 python/django code including management commands). Dev server seems to be
 taking a lot of time to reload after making changes. I was wondering if 
 this
 is due to any bad programming practice at my end? Or is this expected once
 the project grows big? I wanted to know if anyone in the group is dealing
 with it in a better way?

 - Regards
 Krishna Bharadwaj
 --
 You received this mess

Re: Error in testing script

2016-07-11 Thread Gary Roach

On 07/10/2016 11:19 PM, Michal Petrucha wrote:

On Sun, Jul 10, 2016 at 02:25:40PM -0700, Gary Roach wrote:

On 07/10/2016 01:57 PM, Gary Roach wrote:

Hi all;

OS Debian Linux KDE desktop
Django 1.9
Python 3.5

Working with tutorial
https://docs.djangoproject.com/en/1.9/intro/tutorial05/
Writing polls/tests.py script

I am consistently getting an error:
NameError: name 'create_question' is not defined.

The first section of tests.py to throw this error is:
def test_index_view_with_two_past_questions(self):
"""
The questions index page may display multiple questions.
"""
create_question(question_text="Past question 1.", days=-30)
create_question(question_text="Past question 2.", days=-5)
response = self.client.get(reverse('polls:index'))
self.assertQuerysetEqual(
response.context['latest_question_list'],
['', '']
)

The code example is in class QuestionMethodTests(TestCase): but is flagged
8 times by the editor throughout the code in test.py. The same error pops
at run time.

The code seems to be identical to the code in the tutorial.

All of the errors occur on code lines like:
create_question(question_text=" ...

All help will be appreciated.

Gary R.


I missed something. The create_question call is a def defined earlier in the
class.

 def create_question(question_text, days):
 """
 Creates a question with the given `question_text` and published the
 given number of `days` offset to now (negative for questions
published
 in the past, positive for questions that have yet to be published).
 """
 time = timezone.now() + datetime.timedelta(days=days)
 return Question.objects.create(question_text=question_text,
 pub_date=time)

this code throws an error : Method 'create_question - polls.tests' should
have self as first parameter.

Here again, the code seems to be identical to that in the tutorial. Adding
self to the def clears this problem but does not clear the rest of the
errors. The def doesn't seem to be working.

Gary R

The code snippet in the tutorial does not put ``create_question``
inside the ``QuestionViewTests`` class, but rather at module level.
That makes a difference.

The way it is written in the tutorial, ``create_question`` is just a
global function that you can call from anywhere as it is.

If you put the ``def`` statement inside the class, that means you are
defining a method in that class, in which case you have to treat it as
such. Unless you decorate it as a static method, or a class method,
you can only call it on an instance of that class, and, just like any
other method in Python, will need to take the class instance as its
first argument, most commonly called ``self``.

Does this help clear it up at least a little bit?

Good luck,

Michal


Thanks Michal

I didn't catch that the def statement was shifted to the left margin. 
Works fine now.


Gary R

--
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/589a8274-8f98-2d86-c57f-ef30715559b6%40verizon.net.
For more options, visit https://groups.google.com/d/optout.


static files suspicious operation, os error, and list of paths

2016-07-11 Thread Malik Rumi
Well, I'm stuck again. I am still trying to get my dev site to work with 
this new bootstrap theme. Debug toolbar is telling me over 1,000 
staticfiles have been found, but none were used. So if they are found, why 
aren't they used? I ran findstatic and got this traceback:

(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py 
> findstatic /static/bootstrap/css/bootstrap.css
> Traceback (most recent call last):
> 
>   File 
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/utils/_os.py",
>  
> line 78, in safe_join
> 'component ({})'.format(final_path, base_path))
> django.core.exceptions.SuspiciousFileOperation: The joined path 
> (/static/bootstrap/css/bootstrap.css) is located outside of the base path 
> component (/home/malikarumi/Projects/cannon/jamf/static)
> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ 
>


So I took '/static' off the front of the path, because in my settings I 
have:

STATICFILES_DIRS = [
> os.path.join(BASE_DIR, 'static'),
>

and I thought perhaps that was causing a problem, but it made no 
difference:

django.core.exceptions.SuspiciousFileOperation: The joined path 
(/bootstrap/css/bootstrap.css) is located outside of the base path 
component (/home/malikarumi/Projects/cannon/jamf/static)


Then, following 
https://docs.djangoproject.com/en/1.9/ref/settings/#staticfiles-dirs, I 
made a list of all the paths with bootstrap stuff in them, but then I got a 
new error:

  File 
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>  
> line 299, in listdir
> for entry in os.listdir(path):
> OSError: [Errno 2] No such file or directory: 
> '/home/Projects/cannon/jamf/static/bootstrap'
>

Note, the string in STATICFILES_DIRS does have the slash after bootstrap, 
but that seems to make no difference:

   '/home/Projects/cannon/jamf/static/bootstrap/',

   
Finally, taking yet another look at the docs, I took the os.dir line out 
and made it another path in the list, but still that made no difference:

  File 
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>  
> line 299, in listdir
> for entry in os.listdir(path):
> OSError: [Errno 2] No such file or directory: 
> '/home/Projects/cannon/jamf/static'
>

   
Need I also say the directory does in fact exist? What's going on here? 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4ca8a3ac-9646-4b30-b950-20ac0402f8c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-11 Thread ludovic coues
Do you define BASE_DIR and STATIC_URL in your settings.py file ?

2016-07-11 23:56 GMT+02:00 Malik Rumi :
> Well, I'm stuck again. I am still trying to get my dev site to work with
> this new bootstrap theme. Debug toolbar is telling me over 1,000 staticfiles
> have been found, but none were used. So if they are found, why aren't they
> used? I ran findstatic and got this traceback:
>
>> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py
>> findstatic /static/bootstrap/css/bootstrap.css
>> Traceback (most recent call last):
>> 
>>   File
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/utils/_os.py",
>> line 78, in safe_join
>> 'component ({})'.format(final_path, base_path))
>> django.core.exceptions.SuspiciousFileOperation: The joined path
>> (/static/bootstrap/css/bootstrap.css) is located outside of the base path
>> component (/home/malikarumi/Projects/cannon/jamf/static)
>> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$
>
>
>
> So I took '/static' off the front of the path, because in my settings I
> have:
>
>> STATICFILES_DIRS = [
>> os.path.join(BASE_DIR, 'static'),
>
>
> and I thought perhaps that was causing a problem, but it made no difference:
>
> django.core.exceptions.SuspiciousFileOperation: The joined path
> (/bootstrap/css/bootstrap.css) is located outside of the base path component
> (/home/malikarumi/Projects/cannon/jamf/static)
>
>
> Then, following
> https://docs.djangoproject.com/en/1.9/ref/settings/#staticfiles-dirs, I made
> a list of all the paths with bootstrap stuff in them, but then I got a new
> error:
>
>>   File
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>> line 299, in listdir
>> for entry in os.listdir(path):
>> OSError: [Errno 2] No such file or directory:
>> '/home/Projects/cannon/jamf/static/bootstrap'
>
>
> Note, the string in STATICFILES_DIRS does have the slash after bootstrap,
> but that seems to make no difference:
>
>'/home/Projects/cannon/jamf/static/bootstrap/',
>
>
> Finally, taking yet another look at the docs, I took the os.dir line out and
> made it another path in the list, but still that made no difference:
>
>>   File
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>> line 299, in listdir
>> for entry in os.listdir(path):
>> OSError: [Errno 2] No such file or directory:
>> '/home/Projects/cannon/jamf/static'
>
>
>
> Need I also say the directory does in fact exist? What's going on here?
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ca8a3ac-9646-4b30-b950-20ac0402f8c5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTbRGANO6xMzoqO2nuGKLQieoobz4%3D6mX5rciNUoRm5kCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-11 Thread Malik Rumi
yes.

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'



On Monday, July 11, 2016 at 2:56:06 PM UTC-7, Malik Rumi wrote:
>
> Well, I'm stuck again. I am still trying to get my dev site to work with 
> this new bootstrap theme. Debug toolbar is telling me over 1,000 
> staticfiles have been found, but none were used. So if they are found, why 
> aren't they used? I ran findstatic and got this traceback:
>
> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py 
>> findstatic /static/bootstrap/css/bootstrap.css
>> Traceback (most recent call last):
>> 
>>   File 
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/utils/_os.py",
>>  
>> line 78, in safe_join
>> 'component ({})'.format(final_path, base_path))
>> django.core.exceptions.SuspiciousFileOperation: The joined path 
>> (/static/bootstrap/css/bootstrap.css) is located outside of the base path 
>> component (/home/malikarumi/Projects/cannon/jamf/static)
>> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ 
>>
>
>
> So I took '/static' off the front of the path, because in my settings I 
> have:
>
> STATICFILES_DIRS = [
>> os.path.join(BASE_DIR, 'static'),
>>
> 
> and I thought perhaps that was causing a problem, but it made no 
> difference:
>
> django.core.exceptions.SuspiciousFileOperation: The joined path 
> (/bootstrap/css/bootstrap.css) is located outside of the base path 
> component (/home/malikarumi/Projects/cannon/jamf/static)
>
>
> Then, following 
> https://docs.djangoproject.com/en/1.9/ref/settings/#staticfiles-dirs, I 
> made a list of all the paths with bootstrap stuff in them, but then I got a 
> new error:
>
>   File 
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>>  
>> line 299, in listdir
>> for entry in os.listdir(path):
>> OSError: [Errno 2] No such file or directory: 
>> '/home/Projects/cannon/jamf/static/bootstrap'
>>
>
> Note, the string in STATICFILES_DIRS does have the slash after bootstrap, 
> but that seems to make no difference:
>
>'/home/Projects/cannon/jamf/static/bootstrap/',
>
>
> Finally, taking yet another look at the docs, I took the os.dir line out 
> and made it another path in the list, but still that made no difference:
>
>   File 
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>>  
>> line 299, in listdir
>> for entry in os.listdir(path):
>> OSError: [Errno 2] No such file or directory: 
>> '/home/Projects/cannon/jamf/static'
>>
>
>
> Need I also say the directory does in fact exist? What's going on here? 
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/faf2b2eb-c8b1-4084-a5a6-cc82ea2d1369%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.