using dajaxice and editlive apps in django - django

So I am pretty new to Django and I am a little confused on how to install apps.
I am trying to get the editlive app to work in Django. This requires dajaxice to also be installed. Both of the instructions for this are very similar, basically it says to change some things in settings.py, urls.py, and add some imports to your main.html.
I did these things, but the instructions don't say what I am supposed to do with the dajaxice, and editlive packages. In each package there is a install.py, should I build and run this? Or am I supposed to just include all the code in with my project?

The python/django community uses a tool called pip to install python packages and libraries. Look up how to install pip on your system (and also look up virtualenv), and then you can simply do:
pip install django-dajaxice
pip install django-editlive

Related

I cannot found modules in Django

I'm trying to connect my Django with my MongoDB.
So, first of all, I install this:
pip install djongo
And all go fine, no errors.
But If you see my models.py archive:
It's like Django it's not finding and I can't import the models.
I tried to install again Django, but it says to me that it's already installed.
I think I'm installing this in another path or something like that, but I don't know how to solve this.
My Django archive its in C:\PROYECTOS\PageSpeed_Insights__Selenium-Python\miweb
It seems that you are installing djongo in your virtualenv paginaweb, you have to configure PyCharm (or whatever IDE you are using) to look for the packages in that virtualenv, here you can see how to do it for PyCharm. It should work after that.

How export python project?

Let me explain elaborately what problem I am facing.
1. I am using Windows environment and pycharm IDE for development of python project.
2. As part of development I am going to use several thrid party python packages say pexpect by installing through pip.
3. Once I am done with development I am going to use python project in Linux environment where I can't install any of these python packages.
So please suggest me way to export python project along with thrid party packages , so that without installing any of 3rd party packages I can run my project in Linux environment.
You have to use virtualenv when you are creating a python project with third party apps. virtualenv is a tool to create isolated Python environments. You can export this project and run in any other environment(Linux, Windows, OSX).
Documentation - Virtualenv
Video - Virtualenv Tutorial
You also need to create a requirement.txt file which will contain your all third party apps. Once you are in virtual environment, you could use the below code:
pip freeze > requirement.txt it will create a requirement.txt file.
For installing all the dependencies again, you need to use:
pip install -r requirement.txt

Is it possible to install a django package without pip?

I am trying to install django-dash to run one of the dashboard examples and see what it's like.
I am on Windows running Python 2.7 and Django 1.6.5. I know the usual approach is to download pip then install the package using pip. However, I am on a work computer with no administrative rights so I can't access my Internet Option Settings to find my proxy URL to follow the instructions below:
Proxy problems
If you work in an office, you might be behind a HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:
http://proxy_url:port
http://username:password#proxy_url:port
I had the same issue when trying to install Django but was able to get it to work by moving the django directory under Python27/Lib/site-packages. Is there something similar I can do with django-dash?
I also tried downloading the sources and running python setup.py install. I received the following error:
File "setup.py", line 3, in <module> from setuptools import setup, find_packages ImportError: No module named setuptools
Link to django-dash: http://django-dash.readthedocs.org/en/latest/
Yes, you can probably get the sources from The Python Package Index
Once you have them, uncompress the files and install them manually (this will depend on you OS).
On Linux systems:
python setup.py build
python setup.py install
Here's the full reference
EDIT : Note that when manually installing those packages, you must also install any missing dependencies, eg. setuptools in your case

How can I uninstall Django apps?

So I was installing an app in order to bootstrap my Django admin interface, and I thought this app was going to be Project specific but it appears to be installed on a global Django level.
http://riccardo.forina.me/bootstrap-your-django-admin-in-3-minutes/
https://github.com/riccardo-forina/django-admin-bootstrapped
My question is how can I uninstall it if I need to do so at a later date? I wanted my project to be as independent as possible. I was also wondering if there was a way of doing the installation within the project so that people that download my repository will automatically get it.
Also some minor questions are that after adding "add django_admin_bootstrapped into the INSTALLED_APPS list before django.contrib.admin" I was not required to run a syncdb command like we usually are when installing models. I guess this applications doesn't creates tables on my database so that is probably why, but I just wanted to know your thoughts.
I know it is a lot to answer but any clarification is appreciated. Thanks.
If you have installed the django app using pip do:
pip uninstall app_name
Or you have to go manually to your site-packages directory and remove it.
After that,
Remove the app from INSTALLED_APPS. django-admin-boostrapped might have overridden your templates. After you are done, do ./manage.py collectstatic and ./manage.py syncdb
If you're writing something that you want other people to use, and it relies on other packages (whether Django apps or more generic Python packages) it's standard to use pip. This makes it easy to install and uninstall packages, and specific versions of those packages. You can then create a requirements.txt file, which you include with your project. This lets other people know what packages are required, and they can easily install them using pip.
So, first off, install pip.
Then you would install django-admin-bootstrapped by doing:
$ pip install django-admin-bootstrapped
You can also install django using pip:
$ pip install django
If you then do this:
$ pip freeze > requirements.txt
you'll end up with a requirements.txt file that lists any packages you've installed with pip, and which version of each. Include that file with your project when you share it with others (on GitHub or wherever). Those people would then do this, to install the same packages:
$ pip install -r requirements.txt
It would also be worth installing and using virtualenv – this lets you have separate environments for your python work, so that when you pip install something it's only available in that environment. Then you can have different versions of packages (eg, different versions of Django) in each environment. Virtualenvwrapper also makes some of the common virtualenv tasks a little easier.
It's a lot to get to grips with at first, as I know from experience, but it's worth doing so and will make development easier in the long term.
As to your other question, it looks like django-admin-bootstrapped doesn't have any models, so it doesn't require any updating of the database after installation.

how to include django templates in app installed via pip?

I'm working on a django app (django-flux) and I'm trying to get it to properly install with pip from pypi. From this blog post and the distutils documentation, it seems like my setup.py and MANIFEST.in files should be including the flux/templates/flux/*.html data files, for example, but they are not included when I install the app via pip for some reason.
Any suggestion on what I am doing wrong? How can you install django templates (among other non-python files)?
For reference, I have distutils 2.7.3.
You are missing include_package_data=True in your setup function.
For more information on this you could turn to Flask's excellent documentation which covers writing a Basic Setup Script:
include_package_data tells distribute to look for a MANIFEST.in file
and install all the entries that match as package data.
Then your are importing find_packages but aren't using it so far (packages = find_packages())