'python -m django' gives conflicting messages in virtualenv -


i created virtualenv:

virtualenv --python=/usr/local/bin/python2.7 workoutpy2.7  

i'm working on workout diary web app, hence name. installed django nonrel in it:

pip install git+https://github.com/django-nonrel/django@nonrel-1.5 

and djangotoolbox django nonrel:

pip install git+https://github.com/django-nonrel/djangotoolbox 

and mongodb engine:

pip install git+https://github.com/django-nonrel/mongodb-engine 

i assumed django installed in virtualenv. typed:

python -m django 

and got following output:

/users/sahandzarrinkoub/documents/programming/web/django/workoutpy2.7/bin/python: no module named django.__main__; 'django' package , cannot directly executed 

what mean? record, same thing happens package install in way. have @ this:

(workoutpy2.7) sahands-macbook-pro:workoutpy2.7 sahandzarrinkoub$ pip install pymongo requirement satisfied: pymongo in ./lib/python2.7/site-packages (workoutpy2.7) sahands-macbook-pro:workoutpy2.7 sahandzarrinkoub$ python -m pymongo /users/sahandzarrinkoub/documents/programming/web/django/workoutpy2.7/bin/python: no module named pymongo.__main__; 'pymongo' package , cannot directly executed 

thankful help.

the -m option python allows (try to) run module/package. docs:

-m <module-name>

search sys.path named module , execute contents __main__ module.

since argument module name, must not give file extension (.py). module name should valid absolute python module name, implementation may not enforce (e.g. may allow use name includes hyphen).

package names (including namespace packages) permitted. when package name supplied instead of normal module, interpreter execute <pkg>.__main__ main module. behaviour deliberately similar handling of directories , zipfiles passed interpreter script argument.

so, thing following -m needs support being run defining __main__, why python -m pymongo states "no module named pymongo.__main__".


for case of django, or specifically, django-nonrel: looks django-nonrel hasn't been updated in years, , recent branch looks fork of django 1.7. django proper added django.__main__ in 1.9, that's why docs you're reading misleading you. might able use django 1.7 tutorial, nosql database might heavily affect models , queries, using tutorial provided nonrel project (if does) preferred.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -