Currently I am trying to work with Django in PowerShell , Windows Vista. According to this blog, I need to
ad a .ps file to PowerShell with the text:
$env:PYTHONPATH=“R:\django\packages\django-trunk”
$env:PATH=$env:PATH + “;D:\Programs\Python25\;R:\django\packages\django-trunk\django\bin”
function django-admin {python (gcm django-admin.py | resolve-path) $args}
However, I cannot find the "django-trunk" folder anywhere under my Python27 directory. Am I overlooking or
misunderstanding something? I am using Python 2.7 with Django 1.4.2.
django-trunk is meant to be the path to your django installation. django-trunk would be the name of the directory if you were using the development version of Django (according to the Django docs).
Your Django installation is probably in ...python2.7/site-packages/django/.
Related
I am trying to find the file Django admin but I can't find it. What command can I use to find where this is located? Thanks.
P.S I am using windows 10
Did you install django according to the documentation? In that case, modules installed via pip (that includes django, which in turn includes the admin) will reside in %USERPROFILE%\Envs, with %USERPROFILE% being %SystemDrive%\Documents and Settings\{your username}
From your terminal, type:
python -c "import django; print(django.__path__)"
i need some help.
I searched in internet but i didn't find any response. I'n new in python nad django :) that causes that i'm here.
Maybe i start at the beginning, i have some project django on heroku hosting, and i have repository on git. I check and i don't have ftp connection to heroku :/ and i have only repository on git. In this repository is requirement.txt file but there no information about version of modules.
I want to prepare enviroment on my ubuntu, i downloaded my existing django project and i started server by command
python manage.py server
I was informed by python that i need to install some of module, and library of python etc. Everything went ok until apperad info
ImportError: No module named plugins
There is no name of plugins this showed just plugins. I installed some module like django-plugins ( i think that module have a folder i dist-package like djangoplugins ). It did not help :/, than i created new folder in dist-package ( in python library folder ) "plugins" and i copied content form djangoplugins . This did not help :/. again showed me "ImportError: No module named plugins". i don't have any idea , whats i need to install, i installed every plugins i found in internet and it didn't help.
Maybe you had this problem ? i know that django can be 1.6 version.]
=====================================
PROBLEM SOLVED
I have wrong version of django and django-cms.
So Cloud9 looks really cool, and you can create python files in it, but I can't figure out how to get it to run a Django project. I imported one from my github account into the IDE, but it says I need to install Django (a django.core import error) so I need to help getting going. Any Ideas? Any skeleton projects on the web that I missed that will do this?
After some research and looking for an answer on different blogs and sites I finally found a solution:
Create a new workspace
Execute easy_install django to install Django
Create new Django project python ./../bin/django-admin.py startproject myproject
Start dev server python ./myproject/manage.py runserver $IP:$PORT
Access http://projectname.username.c9.io
Voilà!!!
I hope this helps
Just write commands in shell as it is:
sudo pip install -r requirements.txt (you should have there django)
than
python manage.py runserver $IP:$PORT
you will have app on https://projectname-username.c9.io
You may also have to add the proper path: <workspace_name>-<username>.c9users.io to the ALLOWED_HOSTS list in django_project/settings.py file, as suggested by the error message returned by django server. Tested on Django 2.0
I am quite a django n00b, but I am reading the eyes out of my head to get it all going. I have a PHP background and struggle with the way and location of reusable apps.
I thought that installed apps should go in an App folder (example django-registration or django-profiles), but after I PIP the app in my virtualenv, I see that the app is installed in a Django folder names "site packages".
Is this the default behavior? Should I copy the 'registration' or 'profile' folder from site packages to my Project? or should I leave them there
Thanks for the help.
If you're intending to simply install packages and not amend their code, there's no problem with them living in Python's site-packages dir.
Because you're using virtualenv, the packages installed while that virtualenv is active will be stored in:
/path/to/virtualenvs/myvirtualenv/lib/python2.x/site-packages/
And it's completely fine for them to stay there. As Daniel R says, what matters is that they are your PYTHONPATH, and virtualenv takes care of making sure they are.
Custom apps you write go in your project. Installed apps you just want to import from into your custom apps can stay in the site-packages folder.
This has nothing to do with Django. This is where Python installs packages. Django doesn't care where they are, as long as they're on the Pythonpath (which they are if they're in site-packages).
I'm still busy with my Django learning adventure. In another post I asked about how to structure a Django project and applications using buildout. In the details of doing this arose another issue, simply installing 3rd party Django applications using either easy_install or setup.py. My question is, where should you install a Django application? If looking at Django documentation, one would think to put a Django application inside the project folder. But if your Django application is an egg (a mystifying term in my opinion) and you use easy_install without option '-b' (build-directory) the application will be installed into your current python site-packages directory. Using option '-b' will put a copy of the application in your directory, but still will install it in your current site-packages directory. Then there are other options like --install-dir and prefix. Also how should installation happen when using setup.py which have similar options as buid-directory, install-dir, and prefix?
Is there a 'good practice' standard for installing 3rd party Django applications into a Django project?
Thank a lot,
Todd
They usually aren't installed directly into the project. They're either installed into the system's site-packages/ directory, or in the virtualenv's site-packages/ directory, or in some other well-defined place that the sysadmin has set for this purpose.
This is where virtualenv comes into its own. It basically enables a project-specific site_packages directory, where you can install all the third-party applications that relate to your project. I'd definitely recommend it.
Follow these steps :
change the path according to your local setup
C:\Python27\Lib\site-packages>python pip install django
Create Project
Go to folder where you want to create a project
E:\djangoProject>C:\Python27\Lib\site-packages\django\bin\django-admin.py startproject myproject
python manage.py help is used to list all the commands
Manage.py This file is kind of your project local django-admin for interacting with your project via command line (start the development server, sync db...)
Run Server
E:\djangoProject\myproject>python manage.py runserver
Create App
E:\djangoProject\myproject>python manage.py startapp myapp
Go to myproject settings.py and register your app “myapp” created under INSTALLED_APPS
Migrate DB E:\djangoProject\myproject>python manage.py migrate
Migrate will create necessary tables or collections depending on your db type, necessary for the admin interface to run