How to get Django classifieds running on my local server - python

I am starting on a project for classified ad listing site and found a template to get me started.
The installation instruction on git are not clear to me.
I created virtual env and installed dependencies using pip but I can't finish the installation process: manage.py runserver could not be executed and showed "could not find module sorl.thumbnail".
I think there is some error due to folder structure but cannot figure out what. Any ideas?
This is my folder structure.

It seems that the dependency sorl.thumbnail is not (successfully) installed.
Try running pip install sorl-thumbnail==11.05.2. That should install the module (in the version required by django-classifieds according to the requirements.txt). Check the output for any errors.
Also, make sure that you are using the right environment.

My only guess is that you either forgot to install sorl.thumbnail or that it is in a separate environment than django-classifieds. To add it manually, download the zip from the specified URL, extract the zip, and, in a command prompt/terminal in the directory you extracted the zip into, and run python setup.py build and python setup.py install.

Related

Not able to install django and use an existing django project

I am studying Django for the first time and everything was going well until the last day. Today when I tried opening my Django project, the terminal returns an error saying :-
Unable to create process using
'C:\Users\User1\AppData\Local\Programs\Python\Python310\python.exe manage.py runserver'
Thinking that it might be an issue with the virtual env, I tried checking my Python Interpreter to make sure I am currently in my venv.
Fortunately, I am currently using my venv but Pycharm indicates me to Install Python Packaging Tools.
I tried the link to install it but it notifies a Non Zero Exit Code(101) and Invalid Python SDK error.
Googling for the error asked me to check the path in Environment Variables where two are present -
C:\Users\User1\AppData\Local\Programs\Python\Python310\
C:\Users\User1\AppData\Local\Programs\Python\Python310\Scripts\
Recently I had added MingW Compiler to the path and that was it. I've never touched the path of Python.
I would like to mention that there are no errors in creating a new virtual envirnoment nor activating it. But things get worse when I try to pip install django. CMD tells that unable to create process.
Please help! I am actually stuck with my project.
Happy to say that I have fixed the issue.
Steps followed include :
Uninstalled Python,Deleted Path,Restarted my pc
Downloaded and Installed Python 3.10.2 from the official site.
Upgraded pip
Installed virtualenv using pip install virtualenv
Tested it creating env using - py -m venv "environment name"
pip install django works + started a project and the setup was successful.
First, try to run any python file (not in your project).
If it works, then the problem is with your django project or the env (try to create a new env and move your files to it).
At last, I think you should reinstall python; this will fix the problem I guess.

ckan.plugins.core.PluginNotFoundException: pages

I'm using CKAN as my open data portal. It's written in Python using Pylons framework. I just want to add a new page similar to about page to display the terms and conditions to the users. About page comes built in.
So I installed ckanext-pages using pip command. What I did was below
1. # Activate your CKAN virtual environment
. /usr/lib/ckan/default/bin/activate
2. # Install the pages extension.
pip install -e 'git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages'
But now I end up with below error which is given when a requested plugin cannot be found.
ckan.plugins.core.PluginNotFoundException: pages
Plugin resides on below path
/usr/lib/ckan/default/src
Please let me know how to fix this?
With your virtualenv activated, run python setup.py develop in the ckanext-pages folder. This will register the plugin so CKAN can find it.
had similar issue. Double-check which paster you are using by command:
which paster
it must show you paster from your current virtualenv, which was /usr/lib/ckan/default in your case
if you are trying #amercader answer, and getting error13 permission denied, with your venv activated:
which python, this will get the path to python in your venv, grap that
run sudo the_path_you_just_grapped setup.py develop
then run the database initialization as in here

Continue developing an already installed application

I recently wrote my first setup.py (with distutils) for an application I'm working on. This installed the library in /usr/local/lib/python and the executable script in /usr/local/bin. This is great, except I want to continue working on it, and whenever I call my application it first looks in /usr/local and runs it from there, instead of the directory I'm at. So I have to manually go and delete the files form these locations. What is the proper way to do this?
If you've got it all packaged up you should be able to say
python setup.py develop
and it will install it locally for you to test.
Then, if you want to uninstall it just
pip uninstall my_package

Developing Python Module

I'd like to start developing an existing Python module. It has a source folder and the setup.py script to build and install it. The build script just copies the source files since they're all python scripts.
Currently, I have put the source folder under version control and whenever I make a change I re-build and re-install. This seems a little slow, and it doesn't settle well with me to "commit" my changes to my python install each time I make a modification. How can I cause my import statement to redirect to my development directory?
Use a virtualenv and use python setup.py develop to link your module to the virtual Python environment. This will make your project's Python packages/modules show up on the sys.path without having to run install.
Example:
% virtualenv ~/virtenv
% . ~/virtenv/bin/activate
(virtenv)% cd ~/myproject
(virtenv)% python setup.py develop
Virtualenv was already mentioned.
And as your files are already under version control you could go one step further and use Pip to install your repo (or a specific branch or tag) into your working environment.
See the docs for Pip's editable option:
-e VCS+REPOS_URL[#REV]#egg=PACKAGE, --editable=VCS+REPOS_URL[#REV]#egg=PACKAGE
Install a package directly from a checkout. Source
will be checked out into src/PACKAGE (lower-case) and
installed in-place (using setup.py develop).
Now you can work on the files that pip automatically checked out for you and when you feel like it, you commit your stuff and push it back to the originating repository.
To get a good, general overview concerning Pip and Virtualenv see this post: http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django
Install the distrubute package then use the developer mode. Just use python setup.py develop --user and that will place path pointers in your user dir location to your workspace.
Change the PYTHONPATH to your source directory. A good idea is to work with an IDE like ECLIPSE that overrides the default PYTHONPATH.

Trouble installing Django

I'm having trouble installing Django, even if I follow the instructions here: http://www.djangobook.com/en/2.0/chapter02/
Could someone please provide baby steps to installing Django. I'm talking baby steps that really break it down, so that a retarded person could do it.
I've installed Django and unzipped the file, but I'm unsure where to go from there.
I on Windows 7, and I've downloaded Python 2.7 and Django 1.2.1.
OK. If you have Python installed, you can then proceed to execute setup.py given with Django. Head over to the directory where you unzipped Django.
cd C:\path\to\Django\
You can now execute
python setup.py install
This step requires your python executable to be present in the system's PATH environment variable. If it isn't you will have to append your Python installation directory to your PATH.
Update
You can verify that the installation has gone well with the following command. Run python and execute the command import django. If no import errors are thrown everything is OK. Thanks to cji for the tip.

Categories