Re: Having issue getting django working on shared hosting account

2017-08-29 Thread Mark Phillips
Linode is a better buy (more ram for the buck) than Digital Ocean. Both are
good hosting companies.

Mark

On Tue, Aug 29, 2017 at 9:18 PM, James Schneider 
wrote:

>
>
> On Aug 29, 2017 5:18 PM, "Thomas Campion"  wrote:
>
> I tried following vendor instructions for installing located at
> https://support.ehost.com/articles/employees/django-with-fastcgi
>
> and cant seem to get anything to display. This is a cheap hosting account
> and support is non existent, though they do advise I should be able to run
> django here. Can someone take a look at the link and tell me if any steps
> are committed or seem wrong?
>
> for this hosting account
> the virtual environment gets created with Python 2.7.8
> django appears to be ver 1.11.4
>
>
> I've tried to follow several other pages on how to set up a jango site but
> have not been able to get anything beyond 500 or 404 errors
>
>
> Not surprising. Support for FastCGI was dropped by Django in version 1.9...
>
> https://docs.djangoproject.com/en/1.8/howto/deployment/
> fastcgi/#how-to-use-django-with-fastcgi-scgi-or-ajp
>
> https://docs.djangoproject.com/en/1.11/releases/1.9/#removed-features-1-9
>
> I'd recommend going with one of the other hosting platforms with better
> support for a Django installation.
>
> -James
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciVR95k3Af8S1N-4VD4NijKerRhA%
> 3DXHFCTYjr4htTbCTGg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2NMvANK_Ji29a%2BWU2XkOBXqQTOUv1GX_aeB-hPRF13qZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having issue getting django working on shared hosting account

2017-08-29 Thread James Schneider
On Aug 29, 2017 5:18 PM, "Thomas Campion"  wrote:

I tried following vendor instructions for installing located at
https://support.ehost.com/articles/employees/django-with-fastcgi

and cant seem to get anything to display. This is a cheap hosting account
and support is non existent, though they do advise I should be able to run
django here. Can someone take a look at the link and tell me if any steps
are committed or seem wrong?

for this hosting account
the virtual environment gets created with Python 2.7.8
django appears to be ver 1.11.4


I've tried to follow several other pages on how to set up a jango site but
have not been able to get anything beyond 500 or 404 errors


Not surprising. Support for FastCGI was dropped by Django in version 1.9...

https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#how-to-use-django-with-fastcgi-scgi-or-ajp

https://docs.djangoproject.com/en/1.11/releases/1.9/#removed-features-1-9

I'd recommend going with one of the other hosting platforms with better
support for a Django installation.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVR95k3Af8S1N-4VD4NijKerRhA%3DXHFCTYjr4htTbCTGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having issue getting django working on shared hosting account

2017-08-29 Thread Alexander Joseph
I think getting a django project to work correctly on a shared hosting 
account might be tricky. If you're open to switching hosting I've tried 
PythonAnywhere, Heroku, and DigitalOcean and definitely recommend 
DigitalOcean. I think the majority of django developers recommend 
DigitalOcean too. Good luck




On Tuesday, August 29, 2017 at 6:19:05 PM UTC-6, Thomas Campion wrote:
>
> I tried following vendor instructions for installing located at 
> https://support.ehost.com/articles/employees/django-with-fastcgi
>
> and cant seem to get anything to display. This is a cheap hosting account 
> and support is non existent, though they do advise I should be able to run 
> django here. Can someone take a look at the link and tell me if any steps 
> are committed or seem wrong?
>
> for this hosting account
> the virtual environment gets created with Python 2.7.8
> django appears to be ver 1.11.4
>
>
> I've tried to follow several other pages on how to set up a jango site but 
> have not been able to get anything beyond 500 or 404 errors
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b19d0e62-46a4-4049-a602-7e39cb394647%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Channels] Worker Live Reload

2017-08-29 Thread Andrew Godwin
There is no live reload on runworker at the moment - this problem will be
mostly fixed with Channels 2.0, though, when we eliminate the need for
runworker.

Until then, it's not an easy thing to add, but if you're feeling ambitious,
it's the sort of thing I would happily take a patch for.

Andrew

On Tue, Aug 29, 2017 at 7:00 PM, Jonatas Baldin 
wrote:

> Hello there!
>
> I'm using Channels with the management command *runworker *with Docker,
> but every time I change my code I need to restart it :(
>
> The Docker configuration is the same for the *runserver* and *runworker*,
> still *runserver* works just fine.
>
> Is this maybe a misconfiguration? Or there's no live reload on *runworker*
> ?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/115a8084-4d60-4427-897c-4008769b8581%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1uqvpHWLHscEq2R-dZJQY_FeiaXaYEMPWzCFTAJMpqPGNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Channels] Worker Live Reload

2017-08-29 Thread Jonatas Baldin
Hello there!

I'm using Channels with the management command *runworker *with Docker, but 
every time I change my code I need to restart it :( 

The Docker configuration is the same for the *runserver* and *runworker*, 
still *runserver* works just fine.

Is this maybe a misconfiguration? Or there's no live reload on *runworker*?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/115a8084-4d60-4427-897c-4008769b8581%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Having issue getting django working on shared hosting account

2017-08-29 Thread Thomas Campion
I tried following vendor instructions for installing located at 
https://support.ehost.com/articles/employees/django-with-fastcgi

and cant seem to get anything to display. This is a cheap hosting account 
and support is non existent, though they do advise I should be able to run 
django here. Can someone take a look at the link and tell me if any steps 
are committed or seem wrong?

for this hosting account
the virtual environment gets created with Python 2.7.8
django appears to be ver 1.11.4


I've tried to follow several other pages on how to set up a jango site but 
have not been able to get anything beyond 500 or 404 errors

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e64f4bc4-69d5-4831-a5f9-d4feeaa74849%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Encapsulating Complex Business Logic in a Migraiton

2017-08-29 Thread James Schneider
On Tue, Aug 29, 2017 at 1:43 PM, Matt S  wrote:

> Standard practice is that you do not refer to "current" models (i.e. from
> app.models import MyModel) in a migration as the migration will break when
> that models changes. This means copying any model-specific code into the
> migration. This becomes impractical when the code needed for the migration
> spans multiple files and models.
>

> How can I encapsulate a complex chain of business logic involving multiple
> models in a migration? For example, if I have instance methods on ModelA
> which calls methods on ModelB, ModelB queries for ModelC and calls methods
> on it. If I use those methods as they exist on the models, the migration
> will eventually break when any of the involved Models' schema changes.
>

I would copy any instance method logic in to separate functions that live
within the individual migration file. Yes, you'll be copy/pasting code that
could live in models, but you need to capture the exact logic used for that
migration step, which should never change moving forward. This isn't code
that you'll be actively maintaining or referring to and shouldn't change
once the migration has been applied.

You do have access to a skeleton version of the models via a RunPython
callback in each migration state by calling apps.get_model(), however, it
only includes the model fields to be used for querying, not any of the
instance methods.

https://docs.djangoproject.com/en/1.11/ref/migration-operations/#django.db.migrations.operations.RunPython
https://docs.djangoproject.com/en/1.11/ref/applications/#django.apps.AppConfig.get_model
https://docs.djangoproject.com/en/1.11/topics/migrations/#historical-models
https://docs.djangoproject.com/en/1.11/topics/migrations/#accessing-models-from-other-apps

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX3ie%3DM3Y8chOmexnUnCCp4RzgxbDVZ-%2BX4YFY2_zOR7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Encapsulating Complex Business Logic in a Migraiton

2017-08-29 Thread Mike Dewhirst

On 30/08/2017 6:43 AM, Matt S wrote:
Standard practice is that you do not refer to "current" models (i.e. 
from app.models import MyModel) in a migration as the migration will 
break when that models changes. This means copying any model-specific 
code into the migration. This becomes impractical when the code needed 
for the migration spans multiple files and models.


How can I encapsulate a complex chain of business logic involving 
multiple models in a migration? For example, if I have instance 
methods on ModelA which calls methods on ModelB, ModelB queries for 
ModelC and calls methods on it. If I use those methods as they exist 
on the models, the migration will eventually break when any of the 
involved Models' schema changes.


In the forwards_func() method after it has been run and done its work, 
and if appropriate, I add an extra line after the docstring ... return None


This effectively switches it off and it never does anything ever again.

Obviously you need to be doing stuff you do not wish to roll-back - ever.



--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a60b8ed4-a5a6-40c8-b959-17e2a3ec3363%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/51f4da70-2ada-4838-bd62-518d196e25e2%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Python and Django traing

2017-08-29 Thread Alexander Joseph
This website is great
https://pythonprogramming.net/

that guys one of the best teachers I've seen


Theres also a guy on youtube (Bucky Roberts?) whos a pretty good teacher 
and has some good django tutorials to get you started. I think his channel 
is called 'thenewboston'


I'd recommend getting and reading 'Two Scoops of Django' once you get the 
basics down. Read it while building your own project and it will help you 
understand how everything works and the right way to do things.



On Saturday, August 26, 2017 at 3:27:52 PM UTC-6, AFSungo wrote:
>
> Hi,
>
> I am beginner and want know:
>
> Where can I find an online and remote class to learn Django??
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86f0616a-7a91-4ffa-b3c6-5bb3a0d29424%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployement Apache

2017-08-29 Thread Daniel Roseman
On Tuesday, 29 August 2017 05:48:57 UTC+1, Vernon Swanepoel wrote:
>
> You can just copy the static files out of Django and into the static files 
> in your project itself.


No. You should absolutely not do that. That is what the `collectstatic` 
command is for.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d1503e9c-388e-4a2c-92b7-b6e87ae9933a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A lot of Problems with Migrating (conceptual)

2017-08-29 Thread Alexander Joseph
Thanks James,
I'm actually starting over from scratch instead of actually refactoring so 
the accounts app is the only real app I have so far. I actually did delete 
the database and just apply migrations to the newly created database and it 
worked ok. I'd like to get better at fixing these migration problems though 
since I'll probably run into a lot of them and wont be able to delete the 
database once I have data.

Do you think it would have been better to run migrations for the specific 
accounts app? I thought it wouldnt matter much since accounts is my only 
app I have so far.

My new structure so far looks like this

business_management/
business_management/
accounts/
migrations/
__init__.py
admin.py
forms.py
models.py
tests.py
views.py
static/
templates/
config/
settings/
__init__.py
base.py
local.py
production.py
__init__.py
docs/
(developer documentation)
requirements/
(requirements.txt files)
utility/
(shell scripts)
manage.py
.gitignore




On Tuesday, August 29, 2017 at 3:35:21 PM UTC-6, James Schneider wrote:
>
>
>
> On Tue, Aug 29, 2017 at 7:13 AM, Alexander Joseph  > wrote:
>
>> I'm not specifying the app level, I'm just running "python manage.py 
>> makemigrations --settings=config.settings.local"  and  "python manage.py 
>> migrate --settings=config.settings.local"
>> I'm not modifying the migrations files and I dont have an app with the 
>> label of admin, thats just the built-in admin. Thanks
>>
>
>
> I know you were doing a lot of refactoring. Did you rename the accounts 
> app after performing an initial migration (applying an old migration with 
> the old app name structure)? It sounds like your DB and your migration 
> files might be out of sync. If you don't have any production data, I would 
> recommend deleting and recreating the entire database, and deleting and 
> recreating your migrations so that all the migrations are run in the 
> correct order.
>
> If you do have data you want to keep, then very likely you now have a ton 
> of work to do writing custom migrations to sync everything back up 
> manually. 
>
> -James
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0686084f-1d5a-4f61-823e-7d84c58f317c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A lot of Problems with Migrating (conceptual)

2017-08-29 Thread James Schneider
On Tue, Aug 29, 2017 at 7:13 AM, Alexander Joseph <
alexander.v.jos...@gmail.com> wrote:

> I'm not specifying the app level, I'm just running "python manage.py
> makemigrations --settings=config.settings.local"  and  "python manage.py
> migrate --settings=config.settings.local"
> I'm not modifying the migrations files and I dont have an app with the
> label of admin, thats just the built-in admin. Thanks
>


I know you were doing a lot of refactoring. Did you rename the accounts app
after performing an initial migration (applying an old migration with the
old app name structure)? It sounds like your DB and your migration files
might be out of sync. If you don't have any production data, I would
recommend deleting and recreating the entire database, and deleting and
recreating your migrations so that all the migrations are run in the
correct order.

If you do have data you want to keep, then very likely you now have a ton
of work to do writing custom migrations to sync everything back up
manually.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUQMcW4e-cqM7w7viK7s6H4oK_F78L8SxmkHJjSmquZzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Encapsulating Complex Business Logic in a Migraiton

2017-08-29 Thread Matt S
Standard practice is that you do not refer to "current" models (i.e. from 
app.models import MyModel) in a migration as the migration will break when 
that models changes. This means copying any model-specific code into the 
migration. This becomes impractical when the code needed for the migration 
spans multiple files and models.

How can I encapsulate a complex chain of business logic involving multiple 
models in a migration? For example, if I have instance methods on ModelA 
which calls methods on ModelB, ModelB queries for ModelC and calls methods 
on it. If I use those methods as they exist on the models, the migration 
will eventually break when any of the involved Models' schema changes.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a60b8ed4-a5a6-40c8-b959-17e2a3ec3363%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Testing file upload via a form?

2017-08-29 Thread Derek
(Python 3.5 and Django 1.10)

I am trying to test a Django form that enables a required file upload.

The form is very simple and includes a field that looks like:

upload_file = forms.FileField()

The corresponding test to try and check the upload:

def test_form_validation_with_file(self):
fake_file = ContentFile(b'''Some file content''')
fake_file.name = 'fake.xls'
suf_file = SimpleUploadedFile('suf.xls', b'''this is text''')
data = {
'upload_file': suf_file,
}
form = forms.RequestForm(data=data)
self.assertTrue(form.is_valid())

The form validation fails i.e. it does not seem to recognise that file data
has been suppplied.

I have also tried with the  "fake_file" for the data but without success.

Any help or pointers appreciated.

Thanks
Derek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF1Wu3OTCbnw4o749YUz-Pa1-Uo9jkGkd1KybB5rSLnp3eAMDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: A lot of Problems with Migrating (conceptual)

2017-08-29 Thread Alexander Joseph
I'm not specifying the app level, I'm just running "python manage.py
makemigrations --settings=config.settings.local"  and  "python manage.py
migrate --settings=config.settings.local"
I'm not modifying the migrations files and I dont have an app with the
label of admin, thats just the built-in admin. Thanks

On Tue, Aug 29, 2017 at 2:47 AM, James Schneider 
wrote:

>
> 
>
>   File "C:\Users\Alexander\Envs\business_management\lib\site-packag
> es\django\core\management\commands\migrate.py", line 86, in handle
> executor.loader.check_consistent_history(connection)
>   File "C:\Users\Alexander\Envs\business_management\lib\site-packag
> es\django\db\migrations\loader.py", line 298, in check_consistent_history
> connection.alias,
> django.db.migrations.exceptions.InconsistentMigrationHistory: Migration
> admin.0001_initial is applied before its dependency accounts.0001_initial
> on database 'default'.
>
>
>
> let me know if you need anymore info to help me out with this. Thanks in
> advance
>
>
>
> How are you generating your migration files?
>
> Are you specifying the app_label after the makemigrations command?
>
> Are you modifying the migration files after they've been generated?
>
> Do you have an app with a label of admin? Or is that a reference to the
> built-in admin?
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/kzNqB9lEIGA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciUKFGrv62awj%2BuuSSuVaS9uYqVs2%2Brv%
> 3DJPsaxvmJGNTfg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best Regards,

Alexander Joseph

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGJrYjZjua%3DYrA70m_aodhDHrS2A-eJ%3DQ6LR_3oEK%3D9NKuD8JQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


change button value

2017-08-29 Thread vishnu bhand
How to change Save button value to Request for a perticular model in django 
admin.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/60c6e09f-accc-4e38-b07e-fcd45264fa64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Upsert Transaction

2017-08-29 Thread James Schneider
On Aug 25, 2017 5:45 AM, "Fendy Purnomo"  wrote:

Hi,

I'm relatively new to Django and have use it in past few months.

Recently I stumbled upon a SQL deadlock. After digging deeper it was caused
by SQL gap lock when inserting.


I'm assuming this was not in a Django app?


Then I found that Django upsert is actually putting update/insert inside
one transaction. I might be missing what's the point of doing this but why
don't we put it in different transaction?


Well, if the insert and update operations we're in separate transactions,
that would make the transactions useless and a waste of resources.

Process 1 Transaction 1: Insert new object with ID 5.
Process 2 Transaction 1: Delete object with ID 5.
Process 1 Transaction 2: Update object with ID 5. (Failed)

May as well not use transactions at that point.

Doing both insert and update in the same transaction keeps Process 2 from
interfering. Both steps would be done together sequentially as part of the
first line above.

However, the transaction would need to close before another process could
act upon that object (including retrieving it). That's a double-edged sword
in some cases.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWvnJbObL7CLPwjugJ8qwg5B1eUW_Ks47VcmkhV1WD7yQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Add Web Service Reference Django project

2017-08-29 Thread James Schneider
On Aug 26, 2017 6:18 AM, "Anar Novruzaliyev" 
wrote:

I need to add web reference and use it in my Django project , How I can do
it or it is possible?

I have no idea what a web reference is. Can you provide an example or more
detailed explanation?

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWrqb%2B-uD3n9tdBE8jM8ScTC90nPAYYPhQ55TJ0QUKYEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: A lot of Problems with Migrating (conceptual)

2017-08-29 Thread James Schneider


  File "C:\Users\Alexander\Envs\business_management\lib\site-packag
es\django\core\management\commands\migrate.py", line 86, in handle
executor.loader.check_consistent_history(connection)
  File "C:\Users\Alexander\Envs\business_management\lib\site-packag
es\django\db\migrations\loader.py", line 298, in check_consistent_history
connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration
admin.0001_initial is applied before its dependency accounts.0001_initial
on database 'default'.



let me know if you need anymore info to help me out with this. Thanks in
advance



How are you generating your migration files?

Are you specifying the app_label after the makemigrations command?

Are you modifying the migration files after they've been generated?

Do you have an app with a label of admin? Or is that a reference to the
built-in admin?

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUKFGrv62awj%2BuuSSuVaS9uYqVs2%2Brv%3DJPsaxvmJGNTfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django filter

2017-08-29 Thread Muhammad M
Please, post your related code (from your models, views and template) here so 
that we can take a look.

Thank you.


> On Aug 29, 2017, at 1:59 AM, sum abiut  > wrote:
> 
> I did that but the approved leave is still showing on the table.
> 
> Cheers
> 
> On Tue, Aug 29, 2017 at 2:44 PM, sum abiut  > wrote:
> Thanks heaps Muhammad.
> Sum
> 
> On Tue, Aug 29, 2017 at 10:13 AM, Muhammad M  > wrote:
> Hi Sum,
> 
> Add an "approved" field of type BooleanField ( ) to your Leave model. 
> 
> So, something like this should work: 
> 
> In app/models.py:
> 
> class Leave (models.Model):
> #other fields go here...
> approved = models.BooleanField ( )
> 
> In app/views.py, handle the query like this:
>  unapproved_leaves = Leave.objects.filter (approved=False)
> 
> Then, do with the returned queryset as you wish. 
> 
> Best of luck.
> 
> Sincerely,
> Muhammad 
> 
> On Aug 28, 2017 7:06 PM, "sum abiut"  > wrote:
> Hi all,
> i am working on an eleave system where staff apply for annual leave and their 
> leave manager approved the leave online.
> 
> currently i have a table that shows all the leave for each department. what i 
> want to accomplished is to only show the leave that are not yet approved on 
> the table. Any leave that have been approved should not be showing on the 
> table.
> 
> Please point me to the right direction.
> 
> 
> Cheers
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPCf-y6f6%3DWtOW%3DQNW%3DD59gWtAmc3avZ4s3jHA09Pgj6C4yXEQ%40mail.gmail.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAJOFuZzTnxOAnmNUBPJP3A3w5ud%2BUYa9W1ZTaTbiTNHnoF1f7A%40mail.gmail.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> 
> 
> -- 
> 
> 
> 
> -- 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPCf-y5v1vM%3Dkz1gwxyjHUpqRX496W2vVDwcveOc%3DzE4sCPixg%40mail.gmail.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6012D894-6D55-420B-8E04-865985B0C4B2%40gmail.com.
For more options, visit 

Re: Deploy production django applications with Python2.7 and Python3.5 on same Apache web server

2017-08-29 Thread James Schneider
On Aug 28, 2017 11:51 PM, "BIJAL MANIAR"  wrote:


I tried serving both Python2.7 and Python3.5 based django applications
through same Apache and it did not work.
Getting below error:

Traceback (most recent call last):
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\site.py", line 67, in

import os
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\os.py", line 409
yield from walk(new_path, topdown, onerror, followlinks)
 ^
SyntaxError: invalid syntax

Can anyone please confirm if there is an alternative to using different
apache instances.



It is impossible to do what you are asking due to the way mod_wsgi is
loaded in to Apache. Only one version of Python may be referenced by an
Apache instance at a time.

Also, you cannot run multiple instances of Apache on the same server of
they are using the same ports (default 80 and 443), and the server only has
a single IP address. To run seperate instances, you'll either need a second
server with its own IP, or you'll need to add a second IP to your existing
server and bind each instance of Apache to a specific IP.

A possible third option is to place a proxy process (such as Nginx or even
a third Apache instance) in front of both of your Apache instances on the
same server (bound to different ports on the localhost adapter). Depending
on the resource requested, that process would proxy the request to the
local bindings of Apache for the appropriate Python version.

Two separate servers is the cleanest solution.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUEkTqSVmBFsDooUTFd_Q6xUhqkh9FbgE8Vw7uoncV_LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploy production django applications with Python2.7 and Python3.5 on same Apache web server

2017-08-29 Thread BIJAL MANIAR

I tried serving both Python2.7 and Python3.5 based django applications 
through same Apache and it did not work.
Getting below error:

Traceback (most recent call last):
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\site.py", line 67, in 

import os
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\os.py", line 409
yield from walk(new_path, topdown, onerror, followlinks)
 ^
SyntaxError: invalid syntax

Can anyone please confirm if there is an alternative to using different 
apache instances.

Thanks,
Bijal

On Monday, August 28, 2017 at 4:50:56 PM UTC+5:30, BIJAL MANIAR wrote:
>
>
> Hi,
>
> I have existing setup of django app within virtual env (Python 2.7, Django 
> 1.11), running on Apache2.2 on production environment.
> On the same server, I want to setup one more django app within virtual env 
> (Python 3.5, Django 1.11).
> How can we have two django apps with two different versions of Python 
> running on same Apache server?
>
> Found an alternative mod_wsgi-express. Below is the link
> http://blog.dscpl.com.au/2015/04/integrating-modwsgi-express-as-django.html
> Is it suitable for production environments and has a good community 
> support? Does it have any limitation?
>
> Please let me know if there are any other ways to achieve this.
>
> Any help would be appreciated.
>
> Thanks,
> Bijal
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c32c92a2-a273-46ea-b190-fc63b4656c67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django migration error: django.db.utils.ProgrammingError: must be owner of relation account_userprofile

2017-08-29 Thread James Schneider
On Aug 28, 2017 6:44 PM, "Samuel Muiruri"  wrote:

getting this error when I'm running migrate, to note this is likely related
to the db connection I believe




/revamp/revampenv/local/lib/python2.7/site-packages/django/db/utils.py",
line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/sammy/revamp/revampenv/local/lib/python2.7/site-
packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)


It probably is. What is the actual exception? Looks like it was cut off
when pasted.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV%2BEWqzeOJegkdib--7790L%3D-Q7YMQqs2ea%3D6-w9ZtqpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django filter

2017-08-29 Thread sum abiut
I did that but the approved leave is still showing on the table.

Cheers

On Tue, Aug 29, 2017 at 2:44 PM, sum abiut  wrote:

> Thanks heaps Muhammad.
> Sum
>
> On Tue, Aug 29, 2017 at 10:13 AM, Muhammad M  wrote:
>
>> Hi Sum,
>>
>> Add an "approved" field of type BooleanField ( ) to your Leave model.
>>
>> So, something like this should work:
>>
>> In app/models.py:
>>
>> class Leave (models.Model):
>> #other fields go here...
>> approved = models.BooleanField ( )
>>
>> In app/views.py, handle the query like this:
>>  unapproved_leaves = Leave.objects.filter (approved=False)
>>
>> Then, do with the returned queryset as you wish.
>>
>> Best of luck.
>>
>> Sincerely,
>> Muhammad
>>
>> On Aug 28, 2017 7:06 PM, "sum abiut"  wrote:
>>
>>> Hi all,
>>> i am working on an eleave system where staff apply for annual leave and
>>> their leave manager approved the leave online.
>>>
>>> currently i have a table that shows all the leave for each department.
>>> what i want to accomplished is to only show the leave that are not yet
>>> approved on the table. Any leave that have been approved should not be
>>> showing on the table.
>>>
>>> Please point me to the right direction.
>>>
>>>
>>> Cheers
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/CAPCf-y6f6%3DWtOW%3DQNW%3DD59gWtAmc3avZ4s3j
>>> HA09Pgj6C4yXEQ%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAJOFuZzTnxOAnmNUBPJP3A3w5ud%2BUYa9W1ZTaTbi
>> TNHnoF1f7A%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>



--

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y5v1vM%3Dkz1gwxyjHUpqRX496W2vVDwcveOc%3DzE4sCPixg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.