What builds the twitter and facebook tables for allauth? - django

I installed the https://github.com/pennersr/django-allauth package via pip. I followed the README.rst and after a bit of rigmarole got almost everything to work.
The facebook, twitter, openid and emailconfirmation sections are now appearing in my admin screen, but when I click on any of their menu items I get an error such as:
no such table: twitter_twitterapp
and a similar error for each of the four new apps. Did I miss a step or some steps in the installation process where the database tables get created?
I'm using sqlite3, if that has any bearing on the isssue.

If you have not already done syncdb then you must do that once. After doing that go in your admin and you will see a section for twitterapp and another for facebookapp. There you need to add the required keys.

Related

How to have countries,cities, regions and subregions in a Django Project

I'm developing a simple website in Django. The main function of the WebApp is to store user information like:
Country of the User
City of the User
Region (of the Country) of the User
Sub-region (of the Country) of the User
District (of the Country) of the User
In my search for solutions I've found one. To use the http://www.geonames.org/ database.
In relation to Django specifically I've found a two Django Apps:
https://github.com/coderholic/django-cities
https://github.com/yourlabs/django-cities-light
I'm currently testing django-cities and I've lost two days trying to import the data. The App is unmaintained and modifications must to be done so the App runs on Django 4 and until now I've not been successful to make it work.
My question here on SO is mainly to ask for help about options. Is GeoNames the only option?
The Django community have other options than django-cities and django-cities-light?
Thanks in advance.
django-cities is maintained and works with Django 4. Just be careful to the installations instructions that are misleading: the package itself is not up to date on Pypi, so you need to install the project using the github repository.
Something like:
pip install git+https://github.com/coderholic/django-cities.git should work

Execute management command from admin with arguments

My little podcast backend written in Django contains a ShowModel. I have also written a custom management command to update episodes for each show from an external API.
For ease of use I'd now like to put a button next to the list of shows in the Django admin to be able to update them from there. I know there's call_command() that also takes the argument but I'm getting a bit stuck in how to bring this into the admin area where the shows are already. Also, if possible I'd also pass the output to the web admin.
You can use this lib https://github.com/vint21h/django-mcadmin
Or try to read the code and pull some pieces to your project.
I was solving the same puzzle of running management commands from the admin interface, so here is what I found pip install -i https://test.pypi.org/simple/ django-run-command
This package helps you to run management commands from the admin dashboard

Magento 2 cannot login admin because form key invalid

I'm in a brain-breaking problem here. I've created a nice Magento 2.1.7 installation with two websites (two stores, two domains) and somehow after a while we are unable to login the backend of Magento.
Invalid Form Key. Please refresh the page.
Now, after trying a few options, still no success. Checked core_config_data, edit max_input_vars, nothing works. The strange thing is, on the front it's still possible to checkout and do your shopping.
Anyway, I'm stumped here. Why is this happening, and how can this be fixed. Any help is welcome.
I often get this error, clearing the cookies for that site, then opening the admin panel in a new tab will resolve this.
You can recreate this error message if you double click the login button after filling out your login information.
Here are a few other reasons you may experience this issue
The form key inputs are outside of the form, you should check the html on the admin panel to check these inputs and exists and have correct values
Make sure the link you use to get to the admin page does not already have a form key in the url
Does this issue generate anything in var/log/system.log ?
Eventually, nothing helped, but what did the trick was creating a new install, setup this new install with all necessary modules (fortunately there were only four), configure the fresh installment like the old one (long live GitHub) and compare your fresh installation to the old one in the database table core_config_data. Basically reproduce your entire setup without any products in it, but just create your stores and categories.
If you spot any differences between the new installment and the old one in the core_config_data, edit them in the old one to be the same as your new one.
Next, edit your env.php with the database credentials to the old database which you've compared and edited.
And the last step, recompile, flush/clean cache and reindex.
Oh, and word of advice, if you're going to use https for your store, setup magento on https. I think something went very wrong when we've changed the base url's from insecure to secure.

Clear all Sitecore Experience Profile data

I tried removing some Contacts from mongo db with Robomongo but Sitecore still lists my contacts in Experience Profile dashboard and now when I click on each I get a not found error now for the ones I deleted.
Is there a way to clear all the Experience profile data to have it like on a fresh installation?
You should follow the instructions from the Walkthrough: Rebuilding the reporting database article. and delete all the files in sitecore_analytics_index folder

How to fix the django_sites table?

Trying to get an oauth module to work I made the pro-move of : manage.py reset sites
This had the effect killing the admin and login functionality of my site.
So, my question is how to I get back to square one and fix what I broke.
Here is my current error when trying to display the admin tool:
DoesNotExist at /admin/
Site matching query does not exist.
Request Method: GET
Request URL: http://mdev.5buckchuck.com/admin/
Django Version: 1.3
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.`
I looked at the documentation but I am lost and tired in it:
http://docs.djangoproject.com/en/1.3/ref/contrib/sites/
It seemed to indicate: manage.py syncdb
So, I wonder what to do next...
You don't really need the sites framework if you only run one site from the project, so the easiest fix would be to remove the following item from your INSTALLED_APPS and the error should go away:
'django.contrib.sites'
You can also re-create the missing Site object from shell. Run python manage.py shell and then:
from django.contrib.sites.models import Site
Site.objects.create(pk=1, domain='mdev.5buckchuck.com', name='5buckchuck.com')
Provide SITE_ID=1 in settings.py. This will work.
I went through this problem too, while playing with django-allauth. The application offers the ability to delete sites. If you delete the one designated by the SITE_ID parameter in settings.py, you'll have to point the correct PK of another valid site.
If you deleted the default site example.com(changes are you did some cleanup after adding another site), you may simply want to select the other site you created by setting SITE_ID to 2 for example. If you work with SQL database, look for the django_site table, and locate the site ID you wish to work with.
This way, no need to go into shell and recreating a not necessary desired site.
If you need sites, you can use data fixtures. Read the docs for tip about enabling the sites framework.