magplan icon indicating copy to clipboard operation
magplan copied to clipboard

Explain how to install it

Open asakura42 opened this issue 4 years ago • 6 comments

Please explain how to install it in couple words. I'm new in all that python things and don't know well how to use Django projects.

asakura42 avatar Jul 07 '21 07:07 asakura42

I'll update README with full process for fresh Django install in a few days.

f1nnix avatar Jul 07 '21 09:07 f1nnix

I would like to clarify my request: I expect to install your system on a local server, without Ansible or Docker. Therefore, it would be interesting to know at least briefly how to run your code myself. I looked in the v1-stable branch and saw in Ansible rules that the system uses postgresql and redis. Tried to replicate it and it didn't work. So I'm looking forward to at least a quick tutorial.

asakura42 avatar Jul 09 '21 19:07 asakura42

Yep, I'll try to update README for local install on fresh Django this weekend.

f1nnix avatar Jul 09 '21 20:07 f1nnix

I've updated readme with magplan-specific installation steps. Also, please, take a look at https://docs.djangoproject.com/en/3.2/intro/tutorial01/ — it's great official tutorial which can lead you into Django from very beginning, explaining you basic stuff like how to create a new Django project and setup database (required for magplan).

Feel free to contact, if you have any issues.

f1nnix avatar Jul 12 '21 22:07 f1nnix

After number of tryings and digging I finally get the ./manage.py migrate semi-work, but got output:

...
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, dynamic_preferences, dynamic_preferences_users, magplan, sessions, sites
Running migrations:
  Applying magplan.0002_auto_20201115_1140...Traceback (most recent call last):
...
django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [<ModelState: 'magplan.User'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
 in an app with no migrations; see https://docs.djangoproject.com/en/3.2/topics/migrations/#dependencies for more

What should I do? Tried some tips from stackexchange, but they doesn't work.

asakura42 avatar Jul 13 '21 09:07 asakura42

Huh, sorry for delay, busy days.

Magplan migrations are heavily realeted on your main app User model: instead of bringing own user, Magplan nicely plays with your's existing one.

One way to make migrations work: for example, you main app is called main. So, in main/models.py define custom user:

from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
	pass

And tell Django to use it. In your settings.py add:

AUTH_USER_MODEL = 'main.User'

Then migrations should work.

If something still goes wrong, drop me a line in this issue, and I finally build a starter project with 100% everything working ;).

~Ilya.

f1nnix avatar Jul 17 '21 21:07 f1nnix