i tried installing django registration:
http://django-registration.readthedocs.org/en/latest/
but i get an error: no module named registration
whenever i load my site.
what can I do?
You should add it to the INSTALLED_APPS list :
Begin by adding registration to the INSTALLED_APPS setting of your
project, and specifying one additional setting:
ACCOUNT_ACTIVATION_DAYS This is the number of days users will have to
activate their accounts after registering. If a user does not activate
within that period, the account will remain permanently inactive and
may be deleted by maintenance scripts provided in django-registration.
This is from the required settings section :
http://django-registration.readthedocs.org/en/latest/quickstart.html#required-settings
So these are the steps that worked for me.
Install using pip
$pip install django-registration
Make sure the django-registration is installed.
$pip list
django-registration should show up.
Add 'django-registration' to INSTALLED_APPS tuple
Hope this helps.
Related
I'm in a selection process and I must develop a software in Django with the restriction of not being able to use the admin included in the framework.
I tried removing it from the INSTALLED_APPS. But when I run a migration I get the error:
'No installed app with label 'admin'
Is there any other configuration that I should do or what is the correct way to do it?
Be sure to remove it from:
urls.py
remove from urlpatterns
remove the import statement
INSTALLED_APPS
That's it.
I found a similar question, with this reply: "...django-simple-blog is an app, meaning you install it within an existing project."
But I need more explanation. Can someone explain to me how to "install" an app within an existing Django project? And what it means to do so? (I use Pycharm).
Django allows us to add multiple apps.
For eg.: if we want to add multiple social authentications, we can install django-allauth
install a thirdparty app
pip install django-allauth # or any other app you like.
or create a new one
django-admin startapp simpleblog
then we modify our settings.py in our django project.
INSTALLED_APPS = [
...,
'allauth', # add the app name here.
'simpleblog',
]
You can refer following to learn more about Django:
https://docs.djangoproject.com/en/2.1/
https://tutorial.djangogirls.org/en/
https://www.twoscoopspress.com/products/two-scoops-of-django-1-11
Django newbie, running on Ubuntu 12.04, Django 1.3.1 and apt-get install python-django-registration.
Trying build a demo site to use the user registration module. I followed the steps from http://lightbird.net/dbe/forum3.html. But when I try to access accounts/ or admin/, getting the following error: "name 'registration' is not defined"
I am able to access the admin interface, after commenting out the registration part in urls.py. Any tips to overcome this issue?
is "registration" in INSTALLED_APPS in settings.py?
Is django-registration on your PYTHONPATH? Also I assume that you did syncdb after adding registration to installed app. If both are true, then try opening a shell prompt with python manage.py shell and import something from the registration module and see what error that gives
I'm trying to install the following django app from the cheeseshop:
https://bitbucket.org/codekoala/django-articles/overview
This is my first day of Django-ing and I'm unsure what to do to get the app's folder populated inside my project.
So far, I've pip installed the app into my virtualenv. This is verified by opening a python shell and getting no errors when I run "import articles"
I've edited the settings.py file and added it to the list of installed apps. I believe this to be OK as I can then run runserver without any "module not found" errors.
syncdb also ran fine.
Where do I go from here?
ie, I would like to have a section of the website called News which uses this app. I have no routes or other apps configured yet, just a clean Django with psycopg2.
EDIT: Enabling the default admin site, I can manage the Articles there, but still unsure of how these will be displayed on the site when I have no app folder created for them. When trying to startapp articles, I'm warned it's conflicting name with an existing module..
No need to create a new app called articles. As you are able to import articles via the python console you have successfully installed it. You can find it in your virtualenv folder in the folder site-packages:
/path_to_your_virtualenv/.virtualenvs/<virtualenvname>/lib/<pythonversion>/site-packages
You can use this app, installed via pip, as it is an app which lives in your project folder.
You just need to include the articles urls in your own urls.py. Since you say you want it under News, this would do fine:
urlpatterns = patterns('',
(r'^news/', include('articles.urls'),
)
Note though that the readme for the articles app implies that you'll need to create your own base template for it to inherit from. Just create a base.html file in a directory called templates under your project, give it a basic HTML structure, and put in {% block content %}{% endblock %} in the relevant place (and the same for the other blocks mentioned in the readme).
You should probably do the Django tutorial anyway, to understand exactly what's going on with the URL and the templates.
I'm new to this, and experimenting with a Django site that has both a main folder and a static media folder. I'm trying to install django-bootstrap, but not sure how to go about it.
I'm using the instructions in this Django Bootstrap page.
First, do I run
pip install -e git+git://github.com/earle/django-bootstrap.git#egg=bootstrap
from the terminal in the main folder, or static media folder?
Second, where do I insert the usage code?
from bootstrap.forms import BootstrapForm, Fieldset
class LoginForm(BootstrapForm):
class Meta:
layout = (
Fieldset("Please Login", "username", "password", ),
)
username = forms.CharField(max_length=100)
password = forms.CharField(widget=forms.PasswordInput(), max_length=100)
The above is obviously only for login fields, but will I need to include that import language in many files, or just one main one?
EDIT for clarity: My host is WebFaction, which uses a Domain + Webapp = Website structure for site hosting. One of their recommended methods for Django installs is to set up the main Django site in one webapp, and a static media folder in another: see here for details.
I am not the site creator or installer, but have copied the site over into a test version so I can mess with its design while the programmer is unavailable for an extended period. I'm looking into Django Bootstrap as a way to make it easier to redesign the site. My skills are obviously limited, but I'm willing to read/learn!
Django-bootstrap is a Django "app", installed as a python package. Since webfaction doesn't do virtualenv, you should be ok* to just ssh in and run
pip install -e git+git://github.com/earle/django-bootstrap.git#egg=bootstrap
from wherever. This will install django-bootstrap to your global python site-packages folder.
Next, you'll need to make sure django knows about it, which you do by editing the settings file and adding it to INSTALLED_APPS, e.g.
INSTALLED_APPS = (
# ... other things
'bootstrap',
# ... maybe more things
)
Any python file that uses the BootstrapForm and Fieldset classes, will require the import statement at the top of it. A python module (file) will only know about a) what you declare directly in it, and b) what you explicitly import. I don't know how you got anywhere using python without knowing that, because it's pretty important. Consider reading up on the subject.*
Anyhow, the only thing django-bootstrap seems to do is change django's form-rendering code to output HTML that is more compatible with Bootstrap. You will still need get twitter-bootstrap yourself, and make sure that you use the media, i.e. the css, js and images, from it. Put the bootstrap media in your static app.
http://twitter.github.com/bootstrap/
*Edit: I just read the last bit of your post and now I feel like a big meanie. So, here are some extra resources that I recommend you read through.
Python samples: http://wiki.python.org/moin/SimplePrograms
Django's Tutorial: https://docs.djangoproject.com/en/1.3/intro/tutorial01/
I'm afraid I don't quite understand the question. pip install will install this in de site-packages folder, not in the location you are running the command from.
The code is a form so would go into a forms.py within the app you are trying to make. That form inherits from BootstraForm, so you would just use the LoginForm where you want and it would be a BootstrapForm.