saisasthaa / django-cron

Automatically exported from code.google.com/p/django-cron
MIT License
0 stars 0 forks source link

__init__.py contains reference to an apps module. #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
  File "/Library/Python/2.5/site-packages/cron/__init__.py", line 23, in
<module>
    from apps.cron.base import cron, Job
ImportError: No module named apps.cron.base

Should line 23 of __init__.py still be referring to apps? Should it not be:
from cron.base import cron, Job

(I still get errors even when I fix this)

Original issue reported on code.google.com by andybak on 19 Nov 2008 at 11:44

GoogleCodeExporter commented 9 years ago
Hey,

First you didn't put any documentation at all. Now, when some kind of 
documentation is included, you use your own application 
deployment rules... (i.e. using some app location for storing your applications 
and thus making your code completely unusable). 
Even if on Oct. 24 you said that the code would be fixed in a week or so, 
there's no sign of improvement. 90% of the people you 
intend to help is clueless about how to make your app work!

So... Do you know the rules for publishing some piece of code you want to make 
available for the rest of the world? Do you 
really want to be of any help when publishing this? If so, please make sure 
your good intentions REALLY have a finality, because 
if not - everything is in vain, and all you obtain is a lots of developer 
nerves and swearing...

It's a shame, this piece of code could really help people...

Regards,
Vali

Original comment by vali.lu...@gmail.com on 27 Nov 2008 at 12:30

GoogleCodeExporter commented 9 years ago
i second this issue... the patches do not seem to work, even when trying to 
manually
apply the changes they don't work.

it seems to me the patches are not applied to the svn trunk... as the trunk 
still has
all the old imports

Original comment by ras...@gmail.com on 4 Feb 2009 at 10:33

GoogleCodeExporter commented 9 years ago
Hi,

I have same problems. Here's how I fixed it:

Setup:
------
I have my apps in the root of my Django-project like this:

project-root
 |___app1
 |___app2
 |___etc...

I made a new app-folder named "cron" to which I copied all the files from SVN 
trunk

project-root
 |___app1
 |___app2
 |___cron
       |__base.py
       |__cron.py
       |__ __init__.py
       |__models.py
       |__views.py

To get this working:
-------------------
The reason django-cron isn't working is that there are bunch of imports that 
presume
all your django apps are in a subfolder "apps" in project root. If your setup 
is as
mine above, you need to fix the following files:

__init__.py:

"from apps.cron.base import cron, Job" ->
"from base import cron, Job"

base.py:

"from cron.signals import cron_done" ->
"from signals import cron_done"

"from cron import models" ->
"import models"

cron.py:
"from cron import cron, Job, models" ->
"import cron, Job, models"

Now there *shouldn't* be any import errors. Let me know if this fix isn't 
working.

Original comment by tatu.kairi@gmail.com on 16 Feb 2009 at 7:29

GoogleCodeExporter commented 9 years ago
I tried your solution, but it isn't working. "import cron, Job, models" in 
cron.py
(from the trunk) give me a "No module named Job" in cron\cron.py in <module>, 
line 23.
I don't know why...

Original comment by Fossati....@gmail.com on 19 Feb 2009 at 12:03

GoogleCodeExporter commented 9 years ago
In fact i've modified the original cron, with the original it gives me No module
named Job in cron\cron.py in <module>, line 27.

Original comment by Fossati....@gmail.com on 19 Feb 2009 at 12:17

GoogleCodeExporter commented 9 years ago
hi,tatu.kairi
i tried your solution,but surface the same problem as Fossati.Clement.of 
course,i
havn't modified the original cron.
i run it under django 1.0 with wsgi running on nginx.
is there any solution for me?thx

Original comment by xur...@gmail.com on 27 Feb 2009 at 4:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fossati, xurwxj, "Job" is a class inside models.py so you need to import it 
using 
"from models import Job" in the places tatu.kairi mentioned

However even after doing this, the code fails

Original comment by mknoke on 24 Mar 2009 at 4:42

GoogleCodeExporter commented 9 years ago
I managed to hack this to the point where it would run without import errors 
and at
least detect the cron jobs. In the course of reading it I realized that theres
nothing special here to deal with apache killing the process. In fact when 
running
under apache, the cron system wont even start until a page request has been 
made. I
would avoid this like the plague, I found many many trivial errors, consider 
this
project in the planning stage, not something you can have any expectation of 
using in
production.

Original comment by seanodon...@gmail.com on 10 Apr 2009 at 1:49

GoogleCodeExporter commented 9 years ago
Renamed the root directory to 'django_cron' to reduce importing confusion.

Also, fixed all code in the app that assumes anything other than being in the 
python
path.

The code all works now and is running on a production server.

Note: there are some server specific settings that can kill the django-cron, 
which I
am looking in to

Original comment by Jim.mixt...@gmail.com on 18 Apr 2009 at 1:14

GoogleCodeExporter commented 9 years ago
Made some backwards compatible changes, but the application works now and it's 
pretty
easy to use (I think)

I also added a readme.txt file which has explains how to use the app

Original comment by Jim.mixt...@gmail.com on 2 Jun 2009 at 2:12