Django - can not use manage.py

i like this post (click again to cancel)
0
i dont like this post (click again to cancel)

Hello,

I tried to setup a Python service with django - however, when I try to run:

dotcloud run coreknowledgeplatform.www python current/manage.py syncdb

I get the following error:

Traceback (most recent call last):
File "current/manage.py", line 11, in <module>
execute_manager(settings)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 436, in execute_manager
setup_environ(settings_mod)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 419, in setup_environ
project_module = import_module(project_name)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named rsync-1309387840.32

I don't know why python is trying to import the rsync folder?

Hope someone knows how to solve this.

 

Thanks in advance.

asked Jul 08 '11

Gjallar gravatar image Gjallar
1 1

3 Answers:

i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel)

You need to add an extra directory; i.e. your manage.py file should not be straight at the root of your app, but inside a subdirectory. You will when be doing stuff like "dotcloud run myapp.www python current/myapp/manage.py syncdb" and that will work!

link

answered Jul 08 '11

jpetazzo gravatar image jpetazzo
363 2 3 7
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

I'm actually finding that you should not put your application in a subfolder but you should have all your dotCloud configuration files inside the root of your application.

Otherwise when you run the app locally the namespace does not include the application name but when you run it on dotCloud it does. This makes it impossible to develop and then publish your code without touching it.

I'm sure this is not the best way to do it but I'm totally new to Python and Django so am just getting things to work the easiest way I can figure out. When I learn a little more Python/Django I'll figure out how to do it the proper way but there seems to be a lot of debate in the Django community itself on how to do development vs. production. This from a language that claims as one of its strengths that there is only one way to do things right.

I have also broken the config files up into three sections: one with global settings, one with local development settings, and one with the server settings.

I set an environment variable in the postinstall shell script like this:

export DJANGO_ENV='prod'

Then in my settings file I test for it like this:

# global settings

DJANGO_ENV = os.environ.get('DJANGO_ENV', 'dev')
if DJANGO_ENV == 'prod':
    # production settings
else:
    #development settings

This way if my app is loaded via the wsgi script, i.e. it's in dotCloud, it automatically loads the production settings but if I'm running the server on my development machine then it loads my local development settings.

You could also just use a development section that overwrites the standard production settings but I like to have the settings specific to production singled out.

link

answered Jan 02 '12

mikbe gravatar image mikbe
1 1
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

me too....

link

answered Jun 30 '11

F4TFOJMH gravatar image F4TFOJMH
1

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

1 follower

Tags:

Stats:

Asked: Jul 08 '11

Seen: 220 times

Last updated: Jan 03 '12

Powered by Askbot version 0.7.23

Copyright DotCloud, 2011. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.